summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-09-19 02:41:21 +0900
committergit <[email protected]>2025-05-12 13:57:24 +0000
commit311b9352a1fb50eef0122b0eeede3494648fcf8f (patch)
tree9f0a19f7e30c966d3fab31587ddbb547e6000fc7
parent46e4c8673747de96838d2c5dec37446d23d99d88 (diff)
[ruby/erb] [DOC] Make documentation 100%
https://github.com/ruby/erb/commit/9152ce8db4
-rw-r--r--ext/erb/escape/escape.c9
-rw-r--r--lib/erb/def_method.rb2
-rw-r--r--lib/erb/util.rb11
3 files changed, 12 insertions, 10 deletions
diff --git a/ext/erb/escape/escape.c b/ext/erb/escape/escape.c
index 67b2d1ef34..db2abd9773 100644
--- a/ext/erb/escape/escape.c
+++ b/ext/erb/escape/escape.c
@@ -65,9 +65,12 @@ optimized_escape_html(VALUE str)
return escaped;
}
-// ERB::Util.html_escape is different from CGI.escapeHTML in the following two parts:
-// * ERB::Util.html_escape converts an argument with #to_s first (only if it's not T_STRING)
-// * ERB::Util.html_escape does not allocate a new string when nothing needs to be escaped
+/*
+ * ERB::Util.html_escape is similar to CGI.escapeHTML but different in the following two parts:
+ *
+ * * ERB::Util.html_escape converts an argument with #to_s first (only if it's not T_STRING)
+ * * ERB::Util.html_escape does not allocate a new string when nothing needs to be escaped
+ */
static VALUE
erb_escape_html(VALUE self, VALUE str)
{
diff --git a/lib/erb/def_method.rb b/lib/erb/def_method.rb
index aee989a926..e503b37140 100644
--- a/lib/erb/def_method.rb
+++ b/lib/erb/def_method.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-#--
+
# ERB::DefMethod
#
# Utility module to define eRuby script as instance method.
diff --git a/lib/erb/util.rb b/lib/erb/util.rb
index 1d2a36275d..47375560e1 100644
--- a/lib/erb/util.rb
+++ b/lib/erb/util.rb
@@ -1,9 +1,5 @@
# frozen_string_literal: true
-#--
-# ERB::Escape
-#
-# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope
-# Rails will not monkey-patch ERB::Escape#html_escape.
+
begin
# We don't build the C extension for JRuby, TruffleRuby, and WASM
if $LOAD_PATH.resolve_feature_path('erb/escape')
@@ -12,6 +8,10 @@ begin
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
+ # Rails will not monkey-patch ERB::Escape#html_escape.
module ERB::Escape
def html_escape(s)
CGI.escapeHTML(s.to_s)
@@ -20,7 +20,6 @@ unless defined?(ERB::Escape)
end
end
-#--
# ERB::Util
#
# A utility module for conversion routines, often handy in HTML generation.