Skip to content
This repository
Browse code

experimental DeprecatedConstantToMethodProxy

  • Loading branch information...
commit 55e2e2e8b4efbe6fdb0a921c19cd8be5650eab0a 1 parent 8bfdabb
Sven Fuchs authored June 21, 2008
17  activesupport/lib/active_support/deprecation.rb
@@ -194,6 +194,23 @@ def warn(callstack, called, args)
194 194
           ActiveSupport::Deprecation.warn("#{@old_const} is deprecated! Use #{@new_const} instead.", callstack)
195 195
         end
196 196
     end
  197
+
  198
+    class DeprecatedConstantToMethodProxy < DeprecationProxy #:nodoc:
  199
+      def initialize(old_const, new_target, new_method)
  200
+        @old_const = old_const
  201
+        @new_target = new_target
  202
+        @new_method = new_method
  203
+      end
  204
+
  205
+      private
  206
+        def target
  207
+          @new_target.__send__(@new_method)
  208
+        end
  209
+
  210
+        def warn(callstack, called, args)
  211
+          ActiveSupport::Deprecation.warn("#{@old_const} is deprecated! Use #{@new_target.inspect}.#{@new_method} instead.", callstack)
  212
+        end
  213
+    end
197 214
   end
198 215
 end
199 216
 

0 notes on commit 55e2e2e

Please sign in to comment.
Something went wrong with that request. Please try again.