summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-25 00:53:36 -0800
committergit <svn-admin@ruby-lang.org>2022-11-25 08:54:18 +0000
commitaddb1cbbfd93d30e4752ec63b2d5ff96a13fac3d (patch)
tree5699d090b4d819c7529730168e292fa6f52efbfb
parent58dc9c931b89931d339cf9db5f329cf650b23be8 (diff)
[ruby/erb] Keep ERB::Util#html_escape private
ERB::Util.html_escape has been public, but ERB::Util#html_escape had been private. https://github.com/ruby/erb/commit/e62210bf56
-rw-r--r--ext/erb/escape/escape.c2
-rw-r--r--lib/erb/util.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/ext/erb/escape/escape.c b/ext/erb/escape/escape.c
index d9dacadff3..862c7e7a39 100644
--- a/ext/erb/escape/escape.c
+++ b/ext/erb/escape/escape.c
@@ -88,7 +88,7 @@ Init_escape(void)
{
rb_cERB = rb_define_class("ERB", rb_cObject);
rb_mUtil = rb_define_module_under(rb_cERB, "Util");
- rb_define_method(rb_mUtil, "html_escape", erb_escape_html, 1);
+ rb_define_module_function(rb_mUtil, "html_escape", erb_escape_html, 1);
rb_cCGI = rb_define_class("CGI", rb_cObject);
id_escapeHTML = rb_intern("escapeHTML");
diff --git a/lib/erb/util.rb b/lib/erb/util.rb
index 9ba4583f82..97f5abbba0 100644
--- a/lib/erb/util.rb
+++ b/lib/erb/util.rb
@@ -21,14 +21,14 @@ module ERB::Util
#
# is a &gt; 0 &amp; a &lt; 10?
#
- unless method_defined?(:html_escape) # for JRuby
+ unless defined?(ERB::Util.html_escape) # for JRuby
def html_escape(s)
CGI.escapeHTML(s.to_s)
end
+ module_function :html_escape
end
alias h html_escape
module_function :h
- module_function :html_escape
#
# A utility method for encoding the String _s_ as a URL.