class String
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.
Public Instance Methods
undent()
click to toggle source
@return [String]
# File lib/vanagon/extensions/string.rb, line 8 def undent gsub(/^.{#{slice(/^\s+/).length}}/, '') end