82 Commits
Author SHA1 Message Date
ydah 28da13e768 [ruby/erb] Respect ERB tag boundaries when detecting magic comments
https://github.com/ruby/erb/commit/934d51e24b
2026-10-06 07:36:22 +00:00
Jean BoussierandScott Myron 76508e8e14 [ruby/erb] Add escape test coverage for strings as long as 128 bytes
Extracted from https://github.com/ruby/erb/pull/141 and
https://github.com/ruby/erb/pull/144

https://github.com/ruby/erb/commit/182850a467

Co-Authored-By: Scott Myron <samyron@gmail.com>
2026-09-13 08:05:52 +00:00
youdie006 8b32c3a9ac [ruby/erb] Only convert with to_s when the argument is not a String
escape.c documents html_escape as converting with #to_s "only if it's
not T_STRING", and the C extension implements that. The pure fallback
converted unconditionally, so a String subclass overriding to_s
escaped different bytes on JRuby than on CRuby.

https://github.com/ruby/erb/commit/0f8b6ce9ce
2026-09-11 12:58:01 +00:00
Jean Boussier aa7bc48bb1 [ruby/erb] escape.c: Fix UB in find_next_match_neon
(https://github.com/ruby/erb/pull/142)

Shifting by 64 or more bits is undefined behavior.

https://github.com/ruby/erb/commit/a9316104fc
2026-09-10 06:37:58 +00:00
Jean Boussier b02556a290 [ruby/erb] Speedup ERB::Util.html_escape with SIMD
(https://github.com/ruby/erb/pull/136)

* Speedup ERB::Util.html_escape with SIMD

The code is lifted from similar work in the `json` gem.
SIMD use is limited to NEON and SSE2 as they can easily be
detected and assumed at compile time.

Using more advanced SIMD implementations would require runtime
detection, which probably isn't worth it.

```
== 1k no matches ==
ruby 4.0.6 (2026-07-14 revision https://github.com/ruby/erb/commit/03b6d3f889) +YJIT +PRISM [arm64-darwin25]
Warming up --------------------------------------
                simd     1.430M i/100ms
Calculating -------------------------------------
                simd     14.719M (± 0.5%) i/s   (67.94 ns/i) -     74.350M in   5.051379s

Comparison:
master:  2389369.8 i/s
  simd: 14718663.6 i/s - 6.16x  faster

== 1k few matches ==
ruby 4.0.6 (2026-07-14 revision https://github.com/ruby/erb/commit/03b6d3f889) +YJIT +PRISM [arm64-darwin25]
Warming up --------------------------------------
                simd   163.731k i/100ms
Calculating -------------------------------------
                simd      1.702M (± 0.6%) i/s  (587.67 ns/i) -      8.514M in   5.003388s

Comparison:
master:  1405436.9 i/s
  simd:  1701649.4 i/s - 1.21x  faster

== 1k many matches ==
ruby 4.0.6 (2026-07-14 revision https://github.com/ruby/erb/commit/03b6d3f889) +YJIT +PRISM [arm64-darwin25]
Warming up --------------------------------------
                simd   153.148k i/100ms
Calculating -------------------------------------
                simd      1.590M (± 1.2%) i/s  (629.01 ns/i) -      7.964M in   5.009249s

Comparison:
master:  1225987.4 i/s
  simd:  1589798.4 i/s - 1.30x  faster
```

NB: I don't have an x86_64 machine to benchmark SSE2.

https://github.com/ruby/erb/commit/d5ddd13686
2026-09-09 06:25:23 +00:00
Hartley McGuire b938d066d8 [ruby/erb] Fix Ractor compatibility regression, add tests
The recent change to use `BasicObject.instance_method(:equal?)` broke
the ability to share frozen ERB templates across Ractors because
`UnboundMethod` isn't shareable.

Freezing the `UnboundMethod` _may_ fix the issue (dependong on Ruby
version), but replacing the constant with an inline call to the
`singleton_class` is simpler (and still avoids calling `equal?` on
`@init`).

There have previously been many contributions to make ERB Ractor safe,
but no tests added to ensure it continues to be Ractor safe, so this
commit also adds some regression tests.

https://github.com/ruby/erb/commit/75f1ea059e
2026-08-04 23:31:26 +00:00
Takashi Kokubun d8cc1a1f83 [ruby/erb] Avoid dispatch in ERB initialization guard
The guard for methods that eval ERB source compared @_init with self.class.singleton_class by calling equal? on @_init. A marshal-loaded object can control @_init, so make the comparison through BasicObject#equal? directly instead of dispatching to the restored object.

This keeps normal ERB instances working while preserving the ArgumentError for marshal-loaded instances.

https://github.com/ruby/erb/commit/4bf35f1749
2026-07-16 20:44:48 +00:00
Takashi KokubunandTristan Madani d1589536d2 [ruby/erb] Prohibit def_method on marshal-loaded ERB instances
Extends the @_init guard to def_method so that an ERB object created
via Marshal.load (which bypasses initialize) raises ArgumentError
instead of evaluating arbitrary source. def_module and def_class both
delegate to def_method and are covered by the same check.

https://github.com/ruby/erb/commit/9d017be4e3

Co-authored-by: Tristan Madani <TristanInSec@gmail.com>
2026-04-21 07:38:32 +00:00
John Hawthorn 107699df9d [ruby/erb] Freeze src in initialize
(https://github.com/ruby/erb/pull/105)

https://github.com/ruby/erb/commit/3d4dc31905
2026-02-23 17:06:17 +00:00
Takashi Kokubun 6365d7b0a5 Reapply "[ruby/erb] Reapply "Remove safe_level and further positional"
This reverts commit 5b6658a406.

With a ruby spec fix.
2025-11-12 12:36:44 -08:00
Takashi Kokubun 5b6658a406 Revert "[ruby/erb] Reapply "Remove safe_level and further positional"
This reverts commit 6ea4f36716.

I'll fix ruby/spec shortly. For now, let me just revert it for ruby/ruby.
2025-11-12 11:59:48 -08:00
Takashi Kokubun 6ea4f36716 [ruby/erb] Reapply "Remove safe_level and further positional
arguments (https://github.com/ruby/erb/pull/7)"
(https://github.com/ruby/erb/pull/95)

This reverts commit https://github.com/ruby/erb/commit/1c02d23dc618.

https://github.com/ruby/erb/commit/4162a24ecc
2025-11-12 19:53:36 +00:00
Nobuyoshi Nakada 7cc3191ea1 [ruby/erb] Fix integer overflow
Fix https://github.com/ruby/erb/pull/87

https://github.com/ruby/erb/commit/75764f022b
2025-10-12 04:57:43 +00:00
Aaron PattersonandJohn Hawthorn 8ac8225c50 Inline Class#new.
This commit inlines instructions for Class#new.  To make this work, we
added a new YARV instructions, `opt_new`.  `opt_new` checks whether or
not the `new` method is the default allocator method.  If it is, it
allocates the object, and pushes the instance on the stack.  If not, the
instruction jumps to the "slow path" method call instructions.

Old instructions:

```
> ruby --dump=insns -e'Object.new'
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,10)>
0000 opt_getconstant_path                   <ic:0 Object>             (   1)[Li]
0002 opt_send_without_block                 <calldata!mid:new, argc:0, ARGS_SIMPLE>
0004 leave
```

New instructions:

```
> ./miniruby --dump=insns -e'Object.new'
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,10)>
0000 opt_getconstant_path                   <ic:0 Object>             (   1)[Li]
0002 putnil
0003 swap
0004 opt_new                                <calldata!mid:new, argc:0, ARGS_SIMPLE>, 11
0007 opt_send_without_block                 <calldata!mid:initialize, argc:0, FCALL|ARGS_SIMPLE>
0009 jump                                   14
0011 opt_send_without_block                 <calldata!mid:new, argc:0, ARGS_SIMPLE>
0013 swap
0014 pop
0015 leave
```

This commit speeds up basic object allocation (`Foo.new`) by 60%, but
classes that take keyword parameters see an even bigger benefit because
no hash is allocated when instantiating the object (3x to 6x faster).

Here is an example that uses `Hash.new(capacity: 0)`:

```
> hyperfine "ruby --disable-gems -e'i = 0; while i < 10_000_000; Hash.new(capacity: 0); i += 1; end'" "./ruby --disable-gems -e'i = 0; while i < 10_000_000; Hash.new(capacity: 0); i += 1; end'"
Benchmark 1: ruby --disable-gems -e'i = 0; while i < 10_000_000; Hash.new(capacity: 0); i += 1; end'
  Time (mean ± σ):      1.082 s ±  0.004 s    [User: 1.074 s, System: 0.008 s]
  Range (min … max):    1.076 s …  1.088 s    10 runs

Benchmark 2: ./ruby --disable-gems -e'i = 0; while i < 10_000_000; Hash.new(capacity: 0); i += 1; end'
  Time (mean ± σ):     627.9 ms ±   3.5 ms    [User: 622.7 ms, System: 4.8 ms]
  Range (min … max):   622.7 ms … 633.2 ms    10 runs

Summary
  ./ruby --disable-gems -e'i = 0; while i < 10_000_000; Hash.new(capacity: 0); i += 1; end' ran
    1.72 ± 0.01 times faster than ruby --disable-gems -e'i = 0; while i < 10_000_000; Hash.new(capacity: 0); i += 1; end'
```

This commit changes the backtrace for `initialize`:

```
aaron@tc ~/g/ruby (inline-new)> cat test.rb
class Foo
  def initialize
    puts caller
  end
end

def hello
  Foo.new
end

hello
aaron@tc ~/g/ruby (inline-new)> ruby -v test.rb
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin24]
test.rb:8:in 'Class#new'
test.rb:8:in 'Object#hello'
test.rb:11:in '<main>'
aaron@tc ~/g/ruby (inline-new)> ./miniruby -v test.rb
ruby 3.5.0dev (2025-03-28T23:59:40Z inline-new c4157884e4) +PRISM [arm64-darwin24]
test.rb:8:in 'Object#hello'
test.rb:11:in '<main>'
```

It also increases memory usage for calls to `new` by 122 bytes:

```
aaron@tc ~/g/ruby (inline-new)> cat test.rb
require "objspace"

class Foo
  def initialize
    puts caller
  end
end

def hello
  Foo.new
end

puts ObjectSpace.memsize_of(RubyVM::InstructionSequence.of(method(:hello)))
aaron@tc ~/g/ruby (inline-new)> make runruby
RUBY_ON_BUG='gdb -x ./.gdbinit -p' ./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems  ./test.rb
656
aaron@tc ~/g/ruby (inline-new)> ruby -v test.rb
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin24]
544
```

Thanks to @ko1 for coming up with this idea!

Co-Authored-By: John Hawthorn <john@hawthorn.email>
2025-04-25 13:46:05 -07:00
Takashi Kokubun 129d208f9a [ruby/erb] Fix line numbers after multi-line <%#
(https://github.com/ruby/erb/pull/42)

https://github.com/ruby/erb/commit/526885923e
2022-11-29 04:56:03 +00:00
Takashi Kokubun 1c0c1c8098 [ruby/erb] Drop deprecated -S option from erb command
We attempted to remove things like this and reverted all of them, but I
think nobody relies on this unlike the positional arguments of
`ERB#initialize`.

https://github.com/ruby/erb/commit/92fde7e403
2022-11-24 22:49:21 +00:00
Takashi Kokubun e5a0abc5de [ruby/erb] Suppress warnings to fix ruby-head CI
(https://github.com/ruby/erb/pull/34)

There seems to be no way to fix this. It doesn't happen in an installed
directory, so it's likely a false positive and/or a bug in rubygems.

  | <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85: warning: <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85: warning: loading in progress, circular require considered harmful - /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb
  | 	from /home/runner/work/erb/erb/libexec/erb:0:in  `require'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb:3:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb:3:in  `require_relative'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/shared_helpers.rb:8:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/shared_helpers.rb:8:in  `require_relative'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/rubygems_integration.rb:3:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/rubygems_integration.rb:3:in  `require'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems.rb:1352:in  `<top (required)>'
  | 	from <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85:in  `require'
  | 	from <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85:in  `require'
2022-11-24 22:35:33 +00:00
Takashi Kokubun dc5d06e9b1 [ruby/erb] Copy CGI.escapeHTML to ERB::Util.html_escape
https://github.com/ruby/erb/commit/ac9b219fa9
2022-11-04 07:07:23 +00:00
Takashi Kokubun 7b6c5f9b5b [ruby/erb] Skip a test for JRuby
https://github.com/ruby/erb/commit/48a75665ab
2022-11-03 05:58:14 +00:00
Takashi Kokubun f667d3afc9 [ruby/erb] Skip tests for truffleruby
https://github.com/ruby/erb/commit/65a7c70a00
2022-11-03 05:58:14 +00:00
Takashi Kokubun c0d18a1aa2 [ruby/erb] Revert "Remove safe_level and further positional arguments (https://github.com/ruby/erb/pull/7)"
This reverts commit https://github.com/ruby/erb/commit/5133efa06f0603ae79292f3b2b942957bc8a442e.

While we already handled this deprecation in many libraries, we noticed
that some (e.g. sprockets) relied on the format of `ERB.version` and
https://github.com/ruby/erb/commit/2b4182eb108b9e42fa30bcfa41931896132f88b8 broke such handling.

Given that the `ERB.version` change was released at 3.1 and it's
obviously new, I'll skip this removal in 3.2 and postpone this to a
future version.
2022-01-17 12:39:17 -08:00
Takashi Kokubun d12a08abb5 [ruby/erb] Remove safe_level and further positional arguments (https://github.com/ruby/erb/pull/7)
[Feature #14256]

https://github.com/ruby/erb/commit/5133efa06f
2022-01-16 06:46:47 +09:00
Takashi Kokubun 922989fa0f [ruby/erb] Warn safe_level and later args even without -w
because, when Ruby 3.1 is released, Ruby 2.5, the last version with the
old method signature, will have been EOL. Therefore we can safely warn
the old interface from Ruby 3.1.

https://github.com/ruby/erb/commit/c3a753f49f
2021-01-21 13:52:02 +09:00
Takashi Kokubun 47b43807a8 [ruby/erb] Make sure erb.rb in this repository is tested
https://github.com/ruby/erb/commit/012faba2e5
2021-01-21 13:12:03 +09:00
Takashi Kokubun 10d12afa41 [ruby/erb] Prefer __dir__ to reduce ../
https://github.com/ruby/erb/commit/cb59f11ec8
2021-01-20 17:46:50 +09:00
Takashi Kokubun 718890aa04 Pend erb command tests for Ruby 2.5 for now 2021-01-20 17:21:09 +09:00
Hiroshi SHIBATA 44d25c6528 Fixup 3292f4d965 2020-08-21 20:40:26 +09:00
Hiroshi SHIBATA 3292f4d965 Fixed the executable path for erb command 2020-08-21 20:28:51 +09:00
Nobuyoshi Nakada 0c3e6e86bd Suppress uninitialized instance variable warnings 2019-07-04 18:12:08 +09:00
nobu b3507bf147 erb.rb: prohibit marshaling [EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-28 03:46:48 +00:00
k0kubun 1ae3e6f3ce erb.rb: increase warn level only when non-zero safe_level
is given.

This is merging Eric's patch in [Bug #15479] to Ruby 2.6's behavior in r66631.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-29 07:26:22 +00:00
k0kubun c02f036090 Revert "erb.rb: print deprecation warning with warn level 1"
This reverts commit b5569b9ab2.

The deprecation is indefinitely postponed.

[Bug #15478]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-29 07:11:38 +00:00
k0kubun b5569b9ab2 erb.rb: print deprecation warning with warn level 1
This was planned to be removed in Ruby 2.7 at first, but I changed my
mind to just keep warning it in Ruby 2.7.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-25 13:57:28 +00:00
k0kubun ab5a3db48e erb.rb: warn invalid trim_mode [Misc #15294]
From: Justin Collins <justin@presidentbeef.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-12 00:37:15 +00:00
nobu dd3851d278 Rename test classes to allow stable test count when running test-all -j
[Fix GH-1763]

From: MSP-Greg <MSP-Greg@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13 06:29:02 +00:00
kazu 8b9a3eaba6 lib/erb.rb: Add uplevel to warn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-24 08:54:19 +00:00
k0kubun cc777d09f4 erb.rb: deprecate safe_level of ERB.new
Also, as it's in the middle of the list of 4 arguments, 3rd and 4th arguments
(trim_mode, eoutvar) are changed to keyword arguments.
Old ways to specify arguments are deprecated and warned now.

bin/erb: deprecate -S option.

We'll remove all of deprecated ones at Ruby 2.7+.

enc/make_encmake.rb: stopped using deprecated interface
ext/etc/mkconstants.rb: ditto
ext/socket/mkconstants.rb: ditto
sample/ripper/ruby2html.rb: ditto
spec/ruby/library/erb/defmethod/def_erb_method_spec.rb: ditto
spec/ruby/library/erb/new_spec.rb: ditto
test/erb/test_erb.rb: ditto
test/erb/test_erb_command.rb: ditto
tool/generic_erb.rb: ditto
tool/ruby_vm/helpers/dumper.rb: ditto
tool/transcode-tblgen.rb: ditto
lib/rdoc/erbio.rb: ditto
lib/rdoc/generator/darkfish.rb: ditto

[Feature #14256]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22 13:28:25 +00:00
k0kubun c46d3de0f5 erb.rb: preserve the behavior for invalid syntax
comment. Fix regression at r58948.

I even don't want to deprecate it because deprecation needs to lex all
embedded Ruby script using Ripper and it would be slow.  So Let me just
keep this behavior of Ruby 2.4. No change is the best compatibility.

This commit stopped using String#-@ because it's harmful for "ambiguous
first argument" warning if we really want to maintain this behavior.

[Bug #14243]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-27 12:40:03 +00:00
nobu 161f4a511a erb.rb: shadow by keys
* lib/erb.rb (ERB#new_toplevel): shadow already defined local
  variables by block local variabes, not to overwrite them.
  [ruby-core:84390] [Bug #14215]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-22 08:08:31 +00:00
nobu bca966617e fix test_erb.rb [GH-1763]
* test/erb/test_erb.rb (test_run): require stringio.  suppress an
  unused variable warning.

From: MSP-Greg <MSP-Greg@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-21 05:01:28 +00:00
k0kubun e16bd0f4d8 bin/erb: change template file encoding to UTF-8
Unlike Ruby source file encoding (script encoding) whose default is
changed to UTF-8 in Ruby 2.0 (Feature #6679), template's file encoding
given to erb(1) has been ASCII-8BIT since ERB supports m17n at r21170.

Like Ruby source file encoding, erb template file encoding should be
UTF-8 in Ruby 2.

[Bug #14095] [ruby-core:83708]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-10 13:59:01 +00:00
k0kubun 054e4bc4fd test_erb.rb: add test cases for uncovered methods
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-26 11:30:45 +00:00
k0kubun 26e32b7d65 test/erb/test_erb.rb: Fix unused variable warning
ruby/test/erb/test_erb.rb:575: warning: assigned but unused variable - foo

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29 10:22:47 +00:00
k0kubun eb1652b571 erb.rb: Add ERB#result_with_hash
[ruby-core:55985] [Feature #8631] [fix GH-1623]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25 15:38:25 +00:00
k0kubun 64c914706e erb.rb: Allow trimming CR in all trim_modes
to unify a behavior with r58823 and r58825.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 17:36:09 +00:00
k0kubun b82ed2ce61 erb.rb: Allow explicit trimming carriage return
when trim_mode is "-", for Windows environments.

[ruby-core:39625] [Bug #5339]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 17:17:22 +00:00
k0kubun 040f275690 erb.rb: Allow trimming carriage return
when trim_mode is "<>", for Windows environments.

[Bug #11464]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 16:50:33 +00:00
k0kubun 53127c2410 erb.rb: Don't encode tilde in #url_encode
Based on patch by madeofcode (Mark Dodwell).
[ruby-core:46168] [Bug #6696] [Fix GH-54]

`~` is a unreserved character.
https://tools.ietf.org/html/rfc3986#section-2.3

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 11:58:09 +00:00
nobu 4f8245b703 erb.rb: fronzen-string-literal in comment [Fix GH-1229]
* lib/erb.rb (ERB::Compiler#detect_magic_comment): allow
  fronzen-string-literal in comment as well as encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29 05:16:29 +00:00
nobu f54b960d30 test_erb.rb: improve assertions
* test/erb/test_erb.rb: improve failure messages with
  assert_respond_to and assert_not_respond_to.

* test/erb/test_erb.rb: use assert_raise instead of assert(false).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29 03:18:05 +00:00