Enable Lint/ErbNewArguments
cop to avoid the deprecated arguments warning
Related 5754a29a974d31cab2b4392716b9825a3d910a69. And follows Ruby standard library style https://github.com/ruby/ruby/commit/3406c5d.
This commit is contained in:
parent
6127b8d920
commit
7ebfb319ff
@ -179,6 +179,9 @@ Layout/TrailingWhitespace:
|
||||
Style/UnneededPercentQ:
|
||||
Enabled: true
|
||||
|
||||
Lint/ErbNewArguments:
|
||||
Enabled: true
|
||||
|
||||
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
||||
Lint/RequireParentheses:
|
||||
Enabled: true
|
||||
|
@ -63,8 +63,7 @@ def migration_template(source, destination, config = {})
|
||||
numbered_destination = File.join(dir, ["%migration_number%", base].join("_"))
|
||||
|
||||
create_migration numbered_destination, nil, config do
|
||||
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.new(::File.binread(source), trim_mode: "-", eoutvar: "@output_buffer").result(context)
|
||||
else
|
||||
ERB.new(::File.binread(source), nil, "-", "@output_buffer").result(context)
|
||||
|
@ -314,8 +314,7 @@ def rc?
|
||||
require "erb"
|
||||
template = File.read("../tasks/release_announcement_draft.erb")
|
||||
|
||||
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+
|
||||
puts ERB.new(template, trim_mode: "<>").result(binding)
|
||||
else
|
||||
puts ERB.new(template, nil, "<>").result(binding)
|
||||
|
Loading…
Reference in New Issue
Block a user