1
0
Fork 0
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:
Ryuta Kamizono 2020-01-20 01:53:54 +09:00
parent 3a85ced1a0
commit eff64790fc

View file

@ -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)