[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
This commit is contained in:
Takashi Kokubun 2022-11-25 00:53:36 -08:00 committed by git
parent 58dc9c931b
commit addb1cbbfd
2 changed files with 3 additions and 3 deletions

View File

@ -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");

View File

@ -21,14 +21,14 @@ module ERB::Util
#
# is a > 0 & a < 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.