Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/vanagon/extensions/string.rb
Overview
String is generally pretty functional, but sometimes you need a couple of small convienence methods to make working with really long or really funky strings easier. This will indent all lines to the margin of the first line, preserving sunsequent indentation while still helping reign in HEREDOCS.
Instance Method Summary collapse
Instance Method Details
#undent ⇒ String
8 9 10 |
# File 'lib/vanagon/extensions/string.rb', line 8 def undent gsub(/^.{#{slice(/^\s+/).length}}/, '') end |