Skip to content

Commit 1d3221a

Browse files
k0kubunmatzbot
authored andcommitted
[ruby/erb] Give up on using resolve_feature_path
Apparently `$LOAD_PATH.resolve_feature_path('erb/escape')` returns true for miniruby but `require 'erb/escape'` fails on it. I still don't want to check it and rescue LoadError at the same time because the code looks too complicated. Let me just rescue LoadError for platforms that don't build native extensions. ruby/erb@3081c6b20f
1 parent e8e7daa commit 1d3221a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/erb/util.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111
# Load or define ERB::Escape#html_escape.
1212
# We don't build the C extention 'cgi/escape' for JRuby, TruffleRuby, and WASM.
13-
if $LOAD_PATH.resolve_feature_path('erb/escape')
13+
# miniruby (used by CRuby build scripts) also fails to load erb/escape.so.
14+
begin
1415
require 'erb/escape'
15-
else
16+
rescue LoadError
1617
# ERB::Escape
1718
#
1819
# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope

0 commit comments

Comments
 (0)