[ruby/erb] Allow requiring erb/escape.so alone
(https://github.com/ruby/erb/pull/37) Prior to this commit, requiring erb/escape first and then requiring erb did not work as expected.
This commit is contained in:
parent
8ac4081aa8
commit
bcdfe12919
@ -1,3 +1,9 @@
|
|||||||
|
begin
|
||||||
|
# ERB::Util.html_escape
|
||||||
|
require 'erb/escape'
|
||||||
|
rescue LoadError # JRuby can't load .so
|
||||||
|
end
|
||||||
|
|
||||||
#--
|
#--
|
||||||
# ERB::Util
|
# ERB::Util
|
||||||
#
|
#
|
||||||
@ -15,10 +21,7 @@ module ERB::Util
|
|||||||
#
|
#
|
||||||
# is a > 0 & a < 10?
|
# is a > 0 & a < 10?
|
||||||
#
|
#
|
||||||
begin
|
unless method_defined?(:html_escape) # for JRuby
|
||||||
# ERB::Util.html_escape
|
|
||||||
require 'erb/escape'
|
|
||||||
rescue LoadError
|
|
||||||
def html_escape(s)
|
def html_escape(s)
|
||||||
CGI.escapeHTML(s.to_s)
|
CGI.escapeHTML(s.to_s)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user