Permalink
Browse files

experimental DeprecatedConstantToMethodProxy

  • Loading branch information...
1 parent 8bfdabb commit 55e2e2e8b4efbe6fdb0a921c19cd8be5650eab0a Sven Fuchs committed Jun 21, 2008
Showing with 17 additions and 0 deletions.
  1. +17 −0 activesupport/lib/active_support/deprecation.rb
@@ -194,6 +194,23 @@ def warn(callstack, called, args)
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

0 comments on commit 55e2e2e

Please sign in to comment.