DEV: correct some Ruby 2.7 deprecations

There are a few left, especially in gems but this makes some progress
This commit is contained in:
Sam Saffron 2020-07-16 17:43:20 +10:00
parent af87911178
commit 906a84d66f
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5
3 changed files with 8 additions and 3 deletions

View File

@ -22,7 +22,7 @@ module ActiveSupport
uncached = "#{method_name}_without_cache" uncached = "#{method_name}_without_cache"
alias_method uncached, method_name alias_method uncached, method_name
define_method(method_name) do |*arguments| m = define_method(method_name) do |*arguments|
# this avoids recursive locks # this avoids recursive locks
found = true found = true
data = cache.fetch(arguments) { found = false } data = cache.fetch(arguments) { found = false }
@ -32,6 +32,11 @@ module ActiveSupport
# so cache is never corrupted # so cache is never corrupted
data.dup data.dup
end end
# https://bugs.ruby-lang.org/issues/16897
if Module.respond_to?(:ruby2_keywords, true)
ruby2_keywords(m)
end
end end
end end

View File

@ -248,7 +248,7 @@ class Plugin::Instance
hidden_method_name = :"#{method_name}_without_enable_check" hidden_method_name = :"#{method_name}_without_enable_check"
klass.public_send(:define_method, hidden_method_name, &block) klass.public_send(:define_method, hidden_method_name, &block)
klass.public_send(callback, options) do |*args| klass.public_send(callback, **options) do |*args|
public_send(hidden_method_name, *args) if plugin.enabled? public_send(hidden_method_name, *args) if plugin.enabled?
end end

View File

@ -12,7 +12,7 @@ module SeedData
def create(site_setting_names: nil) def create(site_setting_names: nil)
I18n.with_locale(@locale) do I18n.with_locale(@locale) do
categories(site_setting_names).each { |params| create_category(params) } categories(site_setting_names).each { |params| create_category(**params) }
end end
end end