summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/erb/util.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/erb/util.rb b/lib/erb/util.rb
index b6de3166d2..9ba4583f82 100644
--- a/lib/erb/util.rb
+++ b/lib/erb/util.rb
@@ -1,3 +1,9 @@
+begin
+ # ERB::Util.html_escape
+ require 'erb/escape'
+rescue LoadError # JRuby can't load .so
+end
+
#--
# ERB::Util
#
@@ -15,10 +21,7 @@ module ERB::Util
#
# is a > 0 & a < 10?
#
- begin
- # ERB::Util.html_escape
- require 'erb/escape'
- rescue LoadError
+ unless method_defined?(:html_escape) # for JRuby
def html_escape(s)
CGI.escapeHTML(s.to_s)
end