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”, ActiveSupport::Deprecation.new)
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)
returns the value of the new one.
(deprecated) constant and of a new constant (both in string form) and a deprecator. The deprecated constant now
DeprecatedConstantProxy transforms a constant into a deprecated one. It takes the full names of an old

def self.new(*args, **options, &block)

def self.new(*args, **options, &block)
  object = args.first
  return object unless object
  super
end

def append_features(base)

def append_features(base)
  @deprecator.warn(@message, caller_locations)
  base.include(target)
end

def class

PLANETS.class # => Array
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 const_missing(name)

def const_missing(name)
  @deprecator.warn(@message, caller_locations)
  target.const_get(name)
end

def extended(base)

def extended(base)
  @deprecator.warn(@message, caller_locations)
  base.extend(target)
end

def initialize(old_const, new_const, deprecator = nil, message: "#{old_const} is deprecated! Use #{new_const} instead.")

def initialize(old_const, new_const, deprecator = nil, message: "#{old_const} is deprecated! Use #{new_const} instead.")
  Kernel.require "active_support/inflector/methods"
  @old_const = old_const
  @new_const = new_const
  ActiveSupport.deprecator.warn("DeprecatedConstantProxy without a deprecator is deprecated") unless deprecator
  @deprecator = deprecator || ActiveSupport::Deprecation._instance
  @message = message
end

def inspect

logs rely on it for diagnostics.
Don't give a deprecation warning on inspect since test/unit and error
def inspect
  target.inspect
end

def method_missing(called, *args, &block)

def method_missing(called, *args, &block)
  @deprecator.warn(@message, caller_locations)
  target.__send__(called, *args, &block)
end

def prepend_features(base)

def prepend_features(base)
  @deprecator.warn(@message, caller_locations)
  base.prepend(target)
end

def target

def target
  ActiveSupport::Inflector.constantize(@new_const.to_s)
end