Module: HandlebarsAssets::Unindent

Included in:
TiltHandlebars
Defined in:
lib/handlebars_assets/tilt_handlebars.rb

Instance Method Summary collapse

Instance Method Details

#unindent(heredoc) ⇒ Object

bit.ly/aze9FV Strip leading whitespace from each line that is the same as the amount of whitespace on the first line of the string. Leaves additional indentation on later lines intact.



9
10
11
# File 'lib/handlebars_assets/tilt_handlebars.rb', line 9

def unindent(heredoc)
  heredoc.gsub /^#{heredoc[/\A\s*/]}/, ''
end