class Object

Public Instance Methods

indent(count, char = ' ') click to toggle source
# File lib/string_hacks.rb, line 5
def indent(count, char = ' ')
  gsub(/([^\n]*)(\n|$)/) do |match|
    last_iteration = ($1 == '' && $2 == '')
    line = ''
    line << (char * count) unless last_iteration
    line << $1
    line << $2
    line
  end
end
rainbow() click to toggle source
# File lib/string_hacks.rb, line 16
def rainbow
  Rainbow.new.colorize(self)
end