class String

Extensions to standard classes

Public Instance Methods

undent() click to toggle source

undents the string by removeing as much leading space as the first line has.

Useful for cases like:

puts <<-EOS.undent
  bla bla bla
  bla 
EOS
# File lib/drudge/ext.rb, line 14
def undent
  gsub(/^.{#{slice(/^ +/).length}}/, '')
end