class ActiveSupport::Deprecation::DeprecatedConstantProxy
[“Mercury”, “Venus”, “Earth”, “Mars”, “Jupiter”, “Saturn”, “Uranus”, “Neptune”]
(Backtrace information…)
# => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead.
PLANETS.map { |planet| planet.capitalize }
PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(‘PLANETS’, ‘PLANETS_POST_2006’)
PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
(In a later update, the original implementation of ‘PLANETS` has been removed.)
PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto)
now returns the value of the new one.
to ActiveSupport::Deprecator
if none is specified. The deprecated constant
(both in string form) and optionally a deprecator. The deprecator defaults
takes the names of an old (deprecated) constant and of a new constant
DeprecatedConstantProxy transforms a constant into a deprecated one. It
def class
PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006')
PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
Returns the class of the new constant.
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