class String

Public Instance Methods

indent(spaces) click to toggle source
# File lib/makitzo/monkeys/string.rb, line 2
def indent(spaces)
  gsub(/^/, " " * spaces)
end
last_line() click to toggle source

returns last non-empty line of string, or the empty string if none exists

# File lib/makitzo/monkeys/string.rb, line 7
def last_line
  lines = split("\n")
  while line = lines.pop
    line.strip!
    return line unless line.length == 0
  end
  return ''
end