class String

def indent(amount, indent_string = nil, indent_empty_lines = false)


"foo\n\nbar".indent(2, nil, true) # => " foo\n \n bar"
"foo\n\nbar".indent(2) # => " foo\n\n bar"

empty lines should be indented. Default is false.
The third argument, +indent_empty_lines+, is a flag that says whether

While +indent_string+ is typically one space or tab, it may be any string.

"foo".indent(2, "\t") # => "\t\tfoo"
"foo\n\t\tbar".indent(2) # => "\t\tfoo\n\t\t\t\tbar"
" foo".indent(2) # => " foo"

none.
peeking at the first indented line, and fallback to a space if there is
use. The default is +nil+, which tells the method to make a guess by
The second argument, +indent_string+, specifies which indent string to

end
some_code
def some_method
# =>
EOS
end
some_code
def some_method
<
Indents the lines in the receiver:
def indent(amount, indent_string = nil, indent_empty_lines = false)
  dup.tap { |_| _.indent!(amount, indent_string, indent_empty_lines) }
end