aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-12-21 01:39:18 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-12-21 01:39:18 +0900
commit8034dde023a64b98c6b3edb80a44e4cc23f8979f (patch)
tree38ad756d57390a272bceb7068c19ad1e25587689 /activesupport
parent3da358ea83b86368021d6f289627d0682d24d30b (diff)
downloadrails-8034dde023a64b98c6b3edb80a44e4cc23f8979f.tar.gz
rails-8034dde023a64b98c6b3edb80a44e4cc23f8979f.tar.bz2
rails-8034dde023a64b98c6b3edb80a44e4cc23f8979f.zip
Module#{define_method,alias_method,undef_method,remove_method} become public since Ruby 2.5
https://bugs.ruby-lang.org/issues/14133
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/deprecation/method_wrappers.rb8
-rw-r--r--activesupport/lib/active_support/testing/time_helpers.rb8
-rw-r--r--activesupport/test/callbacks_test.rb2
3 files changed, 9 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/deprecation/method_wrappers.rb b/activesupport/lib/active_support/deprecation/method_wrappers.rb
index f0c3e37e65..d99571790f 100644
--- a/activesupport/lib/active_support/deprecation/method_wrappers.rb
+++ b/activesupport/lib/active_support/deprecation/method_wrappers.rb
@@ -60,13 +60,13 @@ module ActiveSupport
with_method = "#{aliased_method}_with_deprecation#{punctuation}"
without_method = "#{aliased_method}_without_deprecation#{punctuation}"
- target_module.send(:define_method, with_method) do |*args, &block|
+ target_module.define_method(with_method) do |*args, &block|
deprecator.deprecation_warning(method_name, options[method_name])
send(without_method, *args, &block)
end
- target_module.send(:alias_method, without_method, method_name)
- target_module.send(:alias_method, method_name, with_method)
+ target_module.alias_method(without_method, method_name)
+ target_module.alias_method(method_name, with_method)
case
when target_module.protected_method_defined?(without_method)
@@ -75,7 +75,7 @@ module ActiveSupport
target_module.send(:private, method_name)
end
else
- mod.send(:define_method, method_name) do |*args, &block|
+ mod.define_method(method_name) do |*args, &block|
deprecator.deprecation_warning(method_name, options[method_name])
super(*args, &block)
end
diff --git a/activesupport/lib/active_support/testing/time_helpers.rb b/activesupport/lib/active_support/testing/time_helpers.rb
index f160e66971..5a3fa9346c 100644
--- a/activesupport/lib/active_support/testing/time_helpers.rb
+++ b/activesupport/lib/active_support/testing/time_helpers.rb
@@ -22,7 +22,7 @@ module ActiveSupport
@stubs[object.object_id][method_name] = Stub.new(object, method_name, new_name)
- object.singleton_class.send :alias_method, new_name, method_name
+ object.singleton_class.alias_method new_name, method_name
object.define_singleton_method(method_name, &block)
end
@@ -43,9 +43,9 @@ module ActiveSupport
def unstub_object(stub)
singleton_class = stub.object.singleton_class
- singleton_class.send :silence_redefinition_of_method, stub.method_name
- singleton_class.send :alias_method, stub.method_name, stub.original_method
- singleton_class.send :undef_method, stub.original_method
+ singleton_class.silence_redefinition_of_method stub.method_name
+ singleton_class.alias_method stub.method_name, stub.original_method
+ singleton_class.undef_method stub.original_method
end
end
diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb
index 466b364e9d..79098b2a7d 100644
--- a/activesupport/test/callbacks_test.rb
+++ b/activesupport/test/callbacks_test.rb
@@ -31,7 +31,7 @@ module CallbacksTest
def callback_object(callback_method)
klass = Class.new
- klass.send(:define_method, callback_method) do |model|
+ klass.define_method(callback_method) do |model|
model.history << [:"#{callback_method}_save", :object]
end
klass.new