Skip to content

Commit f2ddf32

Browse files
committed
Just skip building the C extension for TruffleRuby
1 parent b8db70d commit f2ddf32

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

ext/erb/escape/extconf.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
require 'mkmf'
2-
create_makefile 'erb/escape'
2+
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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
#
44
# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope
55
# Rails will not monkey-patch ERB::Escape#html_escape.
6-
case RUBY_ENGINE
7-
when 'jruby', 'truffleruby'
6+
begin
7+
require 'erb/escape'
8+
rescue LoadError # for JRuby, TruffleRuby
9+
end
10+
unless defined?(ERB::Escape)
811
module ERB::Escape
912
def html_escape(s)
1013
CGI.escapeHTML(s.to_s)
1114
end
1215
module_function :html_escape
1316
end
14-
else
15-
require 'erb/escape'
1617
end
1718

1819
#--

0 commit comments

Comments
 (0)