Skip to content

Commit

Permalink
Remove the alias for ERB::Util.t to prevent conflicts with the I18n.t…
Browse files Browse the repository at this point in the history
… method
  • Loading branch information
mamantoha committed Nov 1, 2023
1 parent 945da55 commit 1a318bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions lib/redcloth/erb_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module Util

#
# A utility method for transforming Textile in _s_ to HTML.
#
#
# require "erb"
# include ERB::Util
#
#
# puts textilize("Isn't ERB *great*?")
#
#
# _Generates_
#
#
# <p>Isn&#8217;t <span class="caps">ERB</span> <strong>great</strong>?</p>
#
def textilize( s )
Expand All @@ -19,8 +19,6 @@ def textilize( s )
end
end

alias t textilize
module_function :t
module_function :textilize

end
Expand Down
6 changes: 3 additions & 3 deletions spec/erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

describe "ERB helper" do
it "should add a textile tag to ERB" do
template = %{<%=t "This new ERB tag makes is so _easy_ to use *RedCloth*" %>}
template = %{<%=textilize "This new ERB tag makes is so _easy_ to use *RedCloth*" %>}
expected = %{<p>This new <span class="caps">ERB</span> tag makes is so <em>easy</em> to use <strong>RedCloth</strong></p>}

ERB.new(template).result.should == expected
end
end
end

0 comments on commit 1a318bb

Please sign in to comment.