Skip to content

Commit 769ceb8

Browse files
committed
Use resolve_feature_path with LoadError guard
1 parent 48fc87a commit 769ceb8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/erb/util.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope
55
# Rails will not monkey-patch ERB::Escape#html_escape.
66
begin
7-
require 'erb/escape'
8-
rescue LoadError # for JRuby, TruffleRuby
7+
# We don't build the C extension for JRuby, TruffleRuby, and WASM
8+
if $LOAD_PATH.resolve_feature_path('erb/escape')
9+
require 'erb/escape'
10+
end
11+
rescue LoadError # resolve_feature_path raises LoadError on TruffleRuby 22.3.0
912
end
1013
unless defined?(ERB::Escape)
1114
module ERB::Escape

0 commit comments

Comments
 (0)