class String

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

Returns the indented string, or +nil+ if there was nothing to indent.

Same as +indent+, except it indents the receiver in-place.
def indent!(amount, indent_string = nil, indent_empty_lines = false)
  indent_string = indent_string || self[/^[ \t]/] || " "
  re = indent_empty_lines ? /^/ : /^(?!$)/
  gsub!(re, indent_string * amount)
end