mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Extract message = options[method_name]
out of method definition
This commit is contained in:
parent
3a85ced1a0
commit
eff64790fc
1 changed files with 3 additions and 2 deletions
|
@ -56,11 +56,12 @@ module ActiveSupport
|
|||
mod = nil
|
||||
|
||||
method_names.each do |method_name|
|
||||
message = options[method_name]
|
||||
if target_module.method_defined?(method_name) || target_module.private_method_defined?(method_name)
|
||||
method = target_module.instance_method(method_name)
|
||||
target_module.module_eval do
|
||||
redefine_method(method_name) do |*args, &block|
|
||||
deprecator.deprecation_warning(method_name, options[method_name])
|
||||
deprecator.deprecation_warning(method_name, message)
|
||||
method.bind(self).call(*args, &block)
|
||||
end
|
||||
ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true)
|
||||
|
@ -69,7 +70,7 @@ module ActiveSupport
|
|||
mod ||= Module.new
|
||||
mod.module_eval do
|
||||
define_method(method_name) do |*args, &block|
|
||||
deprecator.deprecation_warning(method_name, options[method_name])
|
||||
deprecator.deprecation_warning(method_name, message)
|
||||
super(*args, &block)
|
||||
end
|
||||
ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true)
|
||||
|
|
Loading…
Reference in a new issue