module HamlLint::Spec::IndentNormalizer
Strips off excess leading indentation from each line so we can use Heredocs for writing code without having the leading indentation count.
Public Instance Methods
normalize_indent(code)
click to toggle source
# File lib/haml_lint/spec/normalize_indent.rb, line 8 def normalize_indent(code) leading_indent = code[/^(\s*)/, 1] code.lstrip.gsub(/\n#{leading_indent}/, "\n") end