We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b8db70d commit f2ddf32Copy full SHA for f2ddf32
2 files changed
ext/erb/escape/extconf.rb
@@ -1,2 +1,7 @@
1
require 'mkmf'
2
-create_makefile 'erb/escape'
+
3
+if RUBY_ENGINE == 'truffleruby'
4
+ File.write('Makefile', dummy_makefile($srcdir).join)
5
+else
6
+ create_makefile 'erb/escape'
7
+end
lib/erb/util.rb
@@ -3,16 +3,17 @@
#
# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope
# Rails will not monkey-patch ERB::Escape#html_escape.
-case RUBY_ENGINE
-when 'jruby', 'truffleruby'
+begin
+ require 'erb/escape'
8
+rescue LoadError # for JRuby, TruffleRuby
9
10
+unless defined?(ERB::Escape)
11
module ERB::Escape
12
def html_escape(s)
13
CGI.escapeHTML(s.to_s)
14
end
15
module_function :html_escape
16
-else
- require 'erb/escape'
17
18
19
#--
0 commit comments