class ActiveSupport::Deprecation::DeprecatedConstantProxy
Default deprecator is ActiveSupport::Deprecation
.deprecator_instance
.
When someone use old constant this will trigger warn
method on
OLD_CONST = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(‘OLD_CONST’, ‘NEW_CONST’, deprecator_instance)
OLD_CONST = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(‘OLD_CONST’, ‘NEW_CONST’)
This DeprecatedConstantProxy transforms constant to deprecated constant.
def class
def class target.class end
def initialize(old_const, new_const, deprecator = ActiveSupport::Deprecation.instance)
def initialize(old_const, new_const, deprecator = ActiveSupport::Deprecation.instance) @old_const = old_const @new_const = new_const @deprecator = deprecator end
def target
def target ActiveSupport::Inflector.constantize(@new_const.to_s) end
def warn(callstack, called, args)
def warn(callstack, called, args) @deprecator.warn("#{@old_const} is deprecated! Use #{@new_const} instead.", callstack) end