class String

Reopens the scope of the standard String-class to extend it with helpful methods.

Temporary replacement for majic's color method.

Public Instance Methods

^(c) click to toggle source
# File library/blur/logging.rb, line 5
def ^ c
  self
end
each_block(size = 8)
Alias for: each_slice
each_slice(size = 8) { |join| ... } click to toggle source

Split a string up in n chunks and then iterate through them, exactly like Enumerable#each_slice.

@return [Enumerator] list of slices. @yieldreturn [Array] list of elements in each slice consecutively.

# File library/blur/enhancements.rb, line 33
def each_slice size = 8
  self.chars.each_slice(size).each{|slice| yield slice.join }
end
Also aliased as: each_block
numeric?() click to toggle source

Checks if the string contains nothing but a numeric value.

@return true if it is a numeric value.

# File library/blur/enhancements.rb, line 24
def numeric?
  self =~ /^\d+$/
end