Module: HandlebarsAssets::Unindent

Included in:
HandlebarsRenderer
Defined in:
lib/handlebars_assets/handlebars_template.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.



10
11
12
# File 'lib/handlebars_assets/handlebars_template.rb', line 10

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