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 " bla bla bla\n bla \n".undent
14 15 16 |
# File 'lib/drudge/ext.rb', line 14 def undent gsub(/^.{#{slice(/^ +/).length}}/, '') end |