Update `TargetRubyVersion` to 2.7 in `.rubocop.yml`
This commit is contained in:
parent
ba97e9f918
commit
2e9c0e04c5
|
@ -4,7 +4,7 @@ require:
|
||||||
- rubocop-rails
|
- rubocop-rails
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: 2.5
|
TargetRubyVersion: 2.7
|
||||||
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
||||||
# to ignore them, so only the ones explicitly set in this file are enabled.
|
# to ignore them, so only the ones explicitly set in this file are enabled.
|
||||||
DisabledByDefault: true
|
DisabledByDefault: true
|
||||||
|
|
|
@ -63,11 +63,7 @@ module Rails
|
||||||
numbered_destination = File.join(dir, ["%migration_number%", base].join("_"))
|
numbered_destination = File.join(dir, ["%migration_number%", base].join("_"))
|
||||||
|
|
||||||
file = create_migration numbered_destination, nil, config do
|
file = create_migration numbered_destination, nil, config do
|
||||||
if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
ERB.new(::File.binread(source), trim_mode: "-", eoutvar: "@output_buffer").result(context)
|
||||||
ERB.new(::File.binread(source), trim_mode: "-", eoutvar: "@output_buffer").result(context)
|
|
||||||
else
|
|
||||||
ERB.new(::File.binread(source), nil, "-", "@output_buffer").result(context)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
Rails::Generators.add_generated_file(file)
|
Rails::Generators.add_generated_file(file)
|
||||||
end
|
end
|
||||||
|
|
|
@ -80,11 +80,7 @@ module GeneratorsTestHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def evaluate_template(file, locals = {})
|
def evaluate_template(file, locals = {})
|
||||||
erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
erb = ERB.new(File.read(file), trim_mode: "-", eoutvar: "@output_buffer")
|
||||||
ERB.new(File.read(file), trim_mode: "-", eoutvar: "@output_buffer")
|
|
||||||
else
|
|
||||||
ERB.new(File.read(file), nil, "-", "@output_buffer")
|
|
||||||
end
|
|
||||||
context = Class.new do
|
context = Class.new do
|
||||||
locals.each do |local, value|
|
locals.each do |local, value|
|
||||||
class_attribute local, default: value
|
class_attribute local, default: value
|
||||||
|
|
Loading…
Reference in New Issue