erb 5.0.2 → 6.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/erb/compiler.rb CHANGED
@@ -225,7 +225,7 @@ class ERB::Compiler # :nodoc:
225
225
  end
226
226
  end
227
227
 
228
- ERB_STAG = %w(<%= <%# <%)
228
+ ERB_STAG = %w(<%= <%# <%).freeze
229
229
  def is_erb_stag?(s)
230
230
  ERB_STAG.member?(s)
231
231
  end
@@ -480,7 +480,6 @@ class ERB::Compiler # :nodoc:
480
480
  end
481
481
  }.new(caller(0)).c
482
482
  private_constant :WARNING_UPLEVEL
483
- # :startdoc:
484
483
 
485
484
  def warn_invalid_trim_mode(mode, uplevel:)
486
485
  warn "Invalid ERB trim mode: #{mode.inspect} (trim_mode: nil, 0, 1, 2, or String composed of '%' and/or '-', '>', '<>')", uplevel: uplevel + WARNING_UPLEVEL
data/lib/erb/util.rb CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  # Load CGI.escapeHTML and CGI.escapeURIComponent.
4
4
  # CRuby:
5
- # cgi.gem v0.1.0+ (Ruby 2.7-3.4) and Ruby 3.5+ stdlib have 'cgi/escape' and CGI.escapeHTML.
6
- # cgi.gem v0.3.3+ (Ruby 3.2-3.4) and Ruby 3.5+ stdlib have CGI.escapeURIComponent.
5
+ # cgi.gem v0.1.0+ (Ruby 2.7-3.4) and Ruby 4.0+ stdlib have 'cgi/escape' and CGI.escapeHTML.
6
+ # cgi.gem v0.3.3+ (Ruby 3.2-3.4) and Ruby 4.0+ stdlib have CGI.escapeURIComponent.
7
7
  # JRuby: cgi.gem has a Java extension 'cgi/escape'.
8
8
  # TruffleRuby: lib/truffle/cgi/escape.rb requires 'cgi/util'.
9
9
  require 'cgi/escape'
10
10
 
11
11
  # Load or define ERB::Escape#html_escape.
12
- # We don't build the C extention 'cgi/escape' for JRuby, TruffleRuby, and WASM.
12
+ # We don't build the C extension 'cgi/escape' for JRuby, TruffleRuby, and WASM.
13
13
  # miniruby (used by CRuby build scripts) also fails to load erb/escape.so.
14
14
  begin
15
15
  require 'erb/escape'
@@ -19,6 +19,7 @@ rescue LoadError
19
19
  # A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope
20
20
  # Rails will not monkey-patch ERB::Escape#html_escape.
21
21
  module ERB::Escape
22
+ # :stopdoc:
22
23
  def html_escape(s)
23
24
  CGI.escapeHTML(s.to_s)
24
25
  end
@@ -47,19 +48,19 @@ module ERB::Util
47
48
  alias h html_escape
48
49
  module_function :h
49
50
 
50
- #
51
- # A utility method for encoding the String _s_ as a URL.
52
- #
53
- # require "erb"
54
- # include ERB::Util
55
- #
56
- # puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
57
- #
58
- # _Generates_
59
- #
60
- # Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
61
- #
62
51
  if CGI.respond_to?(:escapeURIComponent)
52
+ #
53
+ # A utility method for encoding the String _s_ as a URL.
54
+ #
55
+ # require "erb"
56
+ # include ERB::Util
57
+ #
58
+ # puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
59
+ #
60
+ # _Generates_
61
+ #
62
+ # Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
63
+ #
63
64
  def url_encode(s)
64
65
  CGI.escapeURIComponent(s.to_s)
65
66
  end
data/lib/erb/version.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  class ERB
3
- VERSION = '5.0.2'
3
+ # The string \ERB version.
4
+ VERSION = '6.0.3'
4
5
  end