diff options
author | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-06-21 18:12:59 +0200 |
---|---|---|
committer | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-06-21 18:12:59 +0200 |
commit | 55e2e2e8b4efbe6fdb0a921c19cd8be5650eab0a (patch) | |
tree | de5fb9b028dc408bc83080de4d956f65cf46c8e9 /activesupport/lib/active_support/deprecation.rb | |
parent | 8bfdabbd8b5137f91d8bcddc8c3d18961c8e316b (diff) | |
download | rails-55e2e2e8b4efbe6fdb0a921c19cd8be5650eab0a.tar.gz rails-55e2e2e8b4efbe6fdb0a921c19cd8be5650eab0a.tar.bz2 rails-55e2e2e8b4efbe6fdb0a921c19cd8be5650eab0a.zip |
experimental DeprecatedConstantToMethodProxy
Diffstat (limited to 'activesupport/lib/active_support/deprecation.rb')
-rw-r--r-- | activesupport/lib/active_support/deprecation.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index ebdaf86146..36933b007d 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -194,6 +194,23 @@ module ActiveSupport ActiveSupport::Deprecation.warn("#{@old_const} is deprecated! Use #{@new_const} instead.", callstack) end end + + class DeprecatedConstantToMethodProxy < DeprecationProxy #:nodoc: + def initialize(old_const, new_target, new_method) + @old_const = old_const + @new_target = new_target + @new_method = new_method + end + + private + def target + @new_target.__send__(@new_method) + end + + def warn(callstack, called, args) + ActiveSupport::Deprecation.warn("#{@old_const} is deprecated! Use #{@new_target.inspect}.#{@new_method} instead.", callstack) + end + end end end |