From dc5d06e9b145f7d5f8c5f7c3757b43f2d68833fd Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 2 Nov 2022 22:28:45 -0700 Subject: [ruby/erb] Copy CGI.escapeHTML to ERB::Util.html_escape https://github.com/ruby/erb/commit/ac9b219fa9 --- lib/erb.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/erb.rb') diff --git a/lib/erb.rb b/lib/erb.rb index 962eeb6963..c588ae1a65 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -986,7 +986,6 @@ end class ERB # A utility module for conversion routines, often handy in HTML generation. module Util - public # # A utility method for escaping HTML tag characters in _s_. # @@ -1002,6 +1001,17 @@ class ERB def html_escape(s) CGI.escapeHTML(s.to_s) end + end + + begin + require 'erb.so' + rescue LoadError + else + private_constant :Escape + Util.prepend(Escape) + end + + module Util alias h html_escape module_function :h module_function :html_escape -- cgit v1.2.3