Module: Hamlit::Helpers

Extended by:
Helpers
Included in:
Helpers, RailsHelpers
Defined in:
lib/hamlit/helpers.rb

Instance Method Summary collapse

Instance Method Details

#preserve(input) ⇒ Object

The same as original Haml::Helpers#preserve without block support.


7
8
9
10
11
12
13
# File 'lib/hamlit/helpers.rb', line 7

def preserve(input)
  # https://github.com/haml/haml/blob/4.1.0.beta.1/lib/haml/helpers.rb#L130-L133
  s = input.to_s.chomp("\n")
  s.gsub!(/\n/, '
')
  s.delete!("\r")
  s
end