Class: Hpricot::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/html2slim/hpricot_monkeypatches.rb

Instance Method Summary collapse

Instance Method Details

#to_slim(lvl = 0) ⇒ Object



23
24
25
26
27
# File 'lib/html2slim/hpricot_monkeypatches.rb', line 23

def to_slim(lvl=0)
  str = content.to_s
  return nil if str.strip.empty?
  ('  ' * lvl) + %(| #{str.gsub(/\s+/, ' ')})
end