Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/drudge/ext.rb

Overview

Extensions to standard classes

Instance Method Summary collapse

Instance Method Details

#undentObject

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


14
15
16
# File 'lib/drudge/ext.rb', line 14

def undent
  gsub(/^.{#{slice(/^ +/).length}}/, '')
end