Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/drudge/ext.rb
Overview
Extensions to standard classes
Instance Method Summary collapse
-
#undent ⇒ Object
undents the string by removeing as much leading space as the first line has.
Instance Method Details
#undent ⇒ Object
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 |