Module: HpricotTruncator::TextNode
- Defined in:
- vendor/plugins/refinery/lib/refinery/html_truncation_helper.rb
Instance Method Summary collapse
Instance Method Details
#truncate(max_length) ⇒ Object
93 94 95 96 |
# File 'vendor/plugins/refinery/lib/refinery/html_truncation_helper.rb', line 93 def truncate(max_length) # We're using String#scan because Hpricot doesn't distinguish entities. Hpricot::Text.new(content.scan(/&#?[^\W_]+;|./).first(max_length).join) end |