diff options
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/aliasing.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/deprecation.rb | 15 |
2 files changed, 9 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/aliasing.rb b/activesupport/lib/active_support/core_ext/module/aliasing.rb index 19a9297aa4..81e81696d8 100644 --- a/activesupport/lib/active_support/core_ext/module/aliasing.rb +++ b/activesupport/lib/active_support/core_ext/module/aliasing.rb @@ -24,6 +24,7 @@ class Module # Strip out punctuation on predicates or bang methods since # e.g. target?_without_feature is not a valid method name. aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1 + yield(aliased_target, punctuation) if block_given? alias_method "#{aliased_target}_without_#{feature}#{punctuation}", target alias_method target, "#{aliased_target}_with_#{feature}#{punctuation}" end diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index 22ff90642a..22a50f7e8b 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -72,13 +72,14 @@ module ActiveSupport # Declare that a method has been deprecated. def deprecate(*method_names) method_names.each do |method_name| - class_eval(<<-EOS, __FILE__, __LINE__) - def #{method_name}_with_deprecation(*args, &block) - ::ActiveSupport::Deprecation.warn("#{method_name} is deprecated and will be removed from Rails 2.0", caller) - #{method_name}_without_deprecation(*args, &block) - end - EOS - alias_method_chain(method_name, :deprecation) + alias_method_chain(method_name, :deprecation) do |target, punctuation| + class_eval(<<-EOS, __FILE__, __LINE__) + def #{target}_with_deprecation#{punctuation}(*args, &block) + ::ActiveSupport::Deprecation.warn("#{method_name} is deprecated and will be removed from Rails 2.0", caller) + #{target}_without_deprecation#{punctuation}(*args, &block) + end + EOS + end end end end |