mirror of
https://github.com/github/rails.git
synced 2026-01-28 07:48:00 -05:00
experimental DeprecatedConstantToMethodProxy
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user