diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-22 15:03:08 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-22 15:03:08 +0000 |
commit | 8038bb2f96250e4c13fb6ced187482f3bb2c4972 (patch) | |
tree | a8c9c99221c79a914123b250ff6d74c165f2c7df /tool/generic_erb.rb | |
parent | 171c496e5082c2e1e9aad80bcd204c1e850512c1 (diff) | |
download | ruby-8038bb2f96250e4c13fb6ced187482f3bb2c4972.tar.gz |
tool/generic_erb.rb: check ERB version
instead of Ruby's.
When older ERB is installed but Ruby is still 2.6.0, this may cause
error like:
```
Traceback (most recent call last):
5: from ../src/tool/generic_erb.rb:36:in `<main>'
4: from ../src/tool/generic_erb.rb:36:in `map'
3: from ../src/tool/generic_erb.rb:43:in `block in <main>'
2: from ../src/tool/generic_erb.rb:43:in `block (2 levels) in <main>'
1: from /opt/local/lib/ruby/2.6.0/erb.rb:873:in `result'
/opt/local/lib/ruby/2.6.0/erb.rb:869:in `block in result': no implicit conversion of Hash into Integer (TypeError)
```
For safety, I changed this to check ERB's version. See also: r62529.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/generic_erb.rb')
-rw-r--r-- | tool/generic_erb.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tool/generic_erb.rb b/tool/generic_erb.rb index 83c569b55b..42555ef0a0 100644 --- a/tool/generic_erb.rb +++ b/tool/generic_erb.rb @@ -34,7 +34,8 @@ unchanged = color.pass("unchanged") updated = color.fail("updated") result = templates.map do |template| - if RUBY_VERSION >= '2.6' + match = ERB.version.match(/\Aerb\.rb \[(?<version>[^ ]+) /) + if match && match[:version] >= '2.2.0' # Ruby 2.6+ erb = ERB.new(File.read(template), trim_mode: '%-') else erb = ERB.new(File.read(template), nil, '%-') |