[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
This commit is contained in:
Takashi Kokubun 2025-05-13 11:18:17 -07:00 committed by git
parent f82dce148c
commit c71f9b8aee

View File

@ -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