1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Refactor ERB version checking for keyword arguments

Improving code like r62590. See r62529 for details.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-02-27 11:12:23 +00:00
parent 86d9071e0b
commit 3406c5d613
6 changed files with 7 additions and 9 deletions

View file

@ -32,8 +32,7 @@ class RubyVM::Dumper
rescue Errno::ENOENT
raise "don't know how to generate #{path}"
else
match = ERB.version.match(/\Aerb\.rb \[(?<version>[^ ]+) /)
if match && match[:version] >= '2.2.0' # Ruby 2.6+
if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
erb = ERB.new(src, trim_mode: '%-')
else
erb = ERB.new(src, nil, '%-')