aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/deprecation.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-15 03:42:54 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-15 03:42:54 +0000
commit643571ca25bc2fcc701e6def0975f56fe10a732f (patch)
treea6e5aa35aa9e86c349e6620146d0b3d4470373e7 /activesupport/lib/active_support/deprecation.rb
parent3d3ba58dbb2cfd4bbb0c1c868d754134a6f9ea3c (diff)
downloadrails-643571ca25bc2fcc701e6def0975f56fe10a732f.tar.gz
rails-643571ca25bc2fcc701e6def0975f56fe10a732f.tar.bz2
rails-643571ca25bc2fcc701e6def0975f56fe10a732f.zip
alias_method_chain yields method target and punctuation to simplify wrapper method definition. Used by the deprecate module method.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5113 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/deprecation.rb')
-rw-r--r--activesupport/lib/active_support/deprecation.rb15
1 files changed, 8 insertions, 7 deletions
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