Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/utils/string_inject.rb

Overview

Instance Method Summary collapse

Instance Method Details

#unindentObject

Strip leading whitespace from each line that is the same as the amount of whitespace on the first line of the string. Leaves additional indentation on later lines intact.



7
8
9
# File 'lib/utils/string_inject.rb', line 7

def unindent
  gsub /^#{self[/\A[ \t]*/]}/, ''
end