Skip to content

Commit

Permalink
Remove html_truncated? method on truncated strings
Browse files Browse the repository at this point in the history
This feature broke marshaling which is required for caching of truncated
strings. Fixes nono#16
  • Loading branch information
meineerde committed Jul 22, 2016
1 parent 45382ea commit ba734d9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
1 change: 0 additions & 1 deletion lib/html_truncator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def self.truncate(text, max, opts={})
opts = DEFAULT_OPTIONS.merge(opts)
doc = Nokogiri::HTML::DocumentFragment.parse(text)
str, _, opts = doc.truncate(max, opts)
eval "class <<str; def html_truncated?; #{opts[:was_truncated]} end end"
str
end

Expand Down
5 changes: 0 additions & 5 deletions spec/html_truncator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@
HTML_Truncator.truncate("<p>Honorificabilitudinitatibus</p>", 5, :ellipsis => '...', :length_in_chars => true).should == "<p>Honor...</p>"
end

it "says if a string was truncated" do
HTML_Truncator.truncate(short_text, 10).should_not be_html_truncated
HTML_Truncator.truncate(long_text, 10).should be_html_truncated
end

it "doesn't unescape html entities" do
txt = <<EOS
<p>Dans le wiki, le \"titre\" <strong>Log des modifications</strong> s'étale sur toute la largeur de l'écran et la barre de saisie dépasse allégrement la taille dudit écran.<br />
Expand Down

0 comments on commit ba734d9

Please sign in to comment.