summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2025-05-13 11:18:17 -0700
committergit <svn-admin@ruby-lang.org>2025-05-13 18:23:04 +0000
commitc71f9b8aee9b11467e2bb91d841e166f6b36c8af (patch)
tree033c34ceb83b2c57d6783aae11f0c0af27857fc4 /lib
parentf82dce148c2b0a5bfeb87066554be100ad3aa419 (diff)
[ruby/erb] Revert "Refactor the logic of require 'erb/escape'
(https://github.com/ruby/erb/pull/61)" This reverts commit https://github.com/ruby/erb/commit/1c393aa738f3. https://github.com/ruby/erb/commit/1c9200aab0
Diffstat (limited to 'lib')
-rw-r--r--lib/erb/util.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/erb/util.rb b/lib/erb/util.rb
index dc9ab3831b..07151207bf 100644
--- a/lib/erb/util.rb
+++ b/lib/erb/util.rb
@@ -8,11 +8,14 @@
# TruffleRuby: lib/truffle/cgi/escape.rb requires 'cgi/util'.
require 'cgi/escape'
-# Load or define ERB::Escape#html_escape.
-# We don't build the C extention 'cgi/escape' for JRuby, TruffleRuby, and WASM.
-if $LOAD_PATH.resolve_feature_path('erb/escape')
- require 'erb/escape'
-else
+begin
+ # We don't build the C extension for JRuby, TruffleRuby, and WASM
+ if $LOAD_PATH.resolve_feature_path('erb/escape')
+ require 'erb/escape'
+ end
+rescue LoadError # resolve_feature_path raises LoadError on TruffleRuby 22.3.0
+end
+unless defined?(ERB::Escape)
# ERB::Escape
#
# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope