Module: Trunction

Extended by:
Trunction
Included in:
Trunction
Defined in:
lib/trunction.rb,
lib/trunction/version.rb

Defined Under Namespace

Classes: Truncation

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#truncate_html(html, max) ⇒ Object



8
9
10
11
12
# File 'lib/trunction.rb', line 8

def truncate_html(html, max)
  doc = Nokogiri::HTML::DocumentFragment.parse(html)
  Truncation.new(doc, max).execute
  doc.to_html
end