Skip to content

Commit 311b935

Browse files
nobumatzbot
authored andcommitted
[ruby/erb] [DOC] Make documentation 100%
ruby/erb@9152ce8db4
1 parent 46e4c86 commit 311b935

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

ext/erb/escape/escape.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ optimized_escape_html(VALUE str)
6565
return escaped;
6666
}
6767

68-
// ERB::Util.html_escape is different from CGI.escapeHTML in the following two parts:
69-
// * ERB::Util.html_escape converts an argument with #to_s first (only if it's not T_STRING)
70-
// * ERB::Util.html_escape does not allocate a new string when nothing needs to be escaped
68+
/*
69+
* ERB::Util.html_escape is similar to CGI.escapeHTML but different in the following two parts:
70+
*
71+
* * ERB::Util.html_escape converts an argument with #to_s first (only if it's not T_STRING)
72+
* * ERB::Util.html_escape does not allocate a new string when nothing needs to be escaped
73+
*/
7174
static VALUE
7275
erb_escape_html(VALUE self, VALUE str)
7376
{

lib/erb/def_method.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
#--
2+
33
# ERB::DefMethod
44
#
55
# Utility module to define eRuby script as instance method.

lib/erb/util.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# frozen_string_literal: true
2-
#--
3-
# ERB::Escape
4-
#
5-
# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope
6-
# Rails will not monkey-patch ERB::Escape#html_escape.
2+
73
begin
84
# We don't build the C extension for JRuby, TruffleRuby, and WASM
95
if $LOAD_PATH.resolve_feature_path('erb/escape')
@@ -12,6 +8,10 @@
128
rescue LoadError # resolve_feature_path raises LoadError on TruffleRuby 22.3.0
139
end
1410
unless defined?(ERB::Escape)
11+
# ERB::Escape
12+
#
13+
# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope
14+
# Rails will not monkey-patch ERB::Escape#html_escape.
1515
module ERB::Escape
1616
def html_escape(s)
1717
CGI.escapeHTML(s.to_s)
@@ -20,7 +20,6 @@ def html_escape(s)
2020
end
2121
end
2222

23-
#--
2423
# ERB::Util
2524
#
2625
# A utility module for conversion routines, often handy in HTML generation.

0 commit comments

Comments
 (0)