Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/string/indent.rb

Instance Method Summary collapse

Instance Method Details

#indent(number_of_chars, char = ' ') ⇒ Object



2
3
4
5
# File 'lib/string/indent.rb', line 2

def indent number_of_chars, char = ' '
  indentation = char * number_of_chars
  lines.map { |line| "#{indentantation}#{line}"  }.join
end