diff options
author | Kir Shatrov <shatrov@me.com> | 2015-03-20 23:23:41 +0200 |
---|---|---|
committer | Kir Shatrov <shatrov@me.com> | 2015-03-22 23:11:19 +0200 |
commit | a982a42d766169c2170d7f100c2a5ceb5430efb1 (patch) | |
tree | d0513809ec34dc58732cff47b18f4840ff127ade /activesupport/lib/active_support/deprecation/method_wrappers.rb | |
parent | cdbe4fd093a38d9c7c5860138844b7da272556fc (diff) | |
download | rails-a982a42d766169c2170d7f100c2a5ceb5430efb1.tar.gz rails-a982a42d766169c2170d7f100c2a5ceb5430efb1.tar.bz2 rails-a982a42d766169c2170d7f100c2a5ceb5430efb1.zip |
Deprecate alias_method_chain in favour of Module#prepend
…as discussed #19413
Diffstat (limited to 'activesupport/lib/active_support/deprecation/method_wrappers.rb')
-rw-r--r-- | activesupport/lib/active_support/deprecation/method_wrappers.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/deprecation/method_wrappers.rb b/activesupport/lib/active_support/deprecation/method_wrappers.rb index cab8a1b14d..c74e9c40ac 100644 --- a/activesupport/lib/active_support/deprecation/method_wrappers.rb +++ b/activesupport/lib/active_support/deprecation/method_wrappers.rb @@ -31,12 +31,14 @@ module ActiveSupport method_names += options.keys method_names.each do |method_name| - target_module.alias_method_chain(method_name, :deprecation) do |target, punctuation| - target_module.send(:define_method, "#{target}_with_deprecation#{punctuation}") do |*args, &block| + mod = Module.new do + define_method(method_name) do |*args, &block| deprecator.deprecation_warning(method_name, options[method_name]) - send(:"#{target}_without_deprecation#{punctuation}", *args, &block) + super(*args, &block) end end + + target_module.prepend(mod) end end end |