summaryrefslogtreecommitdiff
path: root/lib/erb.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-02 22:28:45 -0700
committergit <svn-admin@ruby-lang.org>2022-11-04 07:07:23 +0000
commitdc5d06e9b145f7d5f8c5f7c3757b43f2d68833fd (patch)
treeb52226f5156906a37dab0970c4d184e19b2b830f /lib/erb.rb
parentb6d7e98f2540500f072c5cc0f136cae69f80055c (diff)
[ruby/erb] Copy CGI.escapeHTML to ERB::Util.html_escape
https://github.com/ruby/erb/commit/ac9b219fa9
Diffstat (limited to 'lib/erb.rb')
-rw-r--r--lib/erb.rb12
1 files changed, 11 insertions, 1 deletions
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