Skip to content

Commit 5c10f56

Browse files
authored
Allow requiring erb/escape.so alone (#37)
Prior to this commit, requiring erb/escape first and then requiring erb did not work as expected.
1 parent f74833c commit 5c10f56

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

lib/erb/util.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
begin
2+
# ERB::Util.html_escape
3+
require 'erb/escape'
4+
rescue LoadError # JRuby can't load .so
5+
end
6+
17
#--
28
# ERB::Util
39
#
@@ -15,10 +21,7 @@ module ERB::Util
1521
#
1622
# is a > 0 & a < 10?
1723
#
18-
begin
19-
# ERB::Util.html_escape
20-
require 'erb/escape'
21-
rescue LoadError
24+
unless method_defined?(:html_escape) # for JRuby
2225
def html_escape(s)
2326
CGI.escapeHTML(s.to_s)
2427
end

0 commit comments

Comments
 (0)