class DeprecatedConstantProxy
Ruby on Rails 8.1.2
Since v4.0.13DeprecatedConstantProxy transforms a constant into a deprecated one. It takes the full names of an old (deprecated) constant and of a new constant (both in string form) and a deprecator. The deprecated constant now returns the value of the new one.
PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto)
# (In a later update, the original implementation of `PLANETS` has been removed.)
PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("PLANETS", "PLANETS_POST_2006", ActiveSupport::Deprecation.new)
PLANETS.map { |planet| planet.capitalize }
# => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead.
(Backtrace information…)
["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
Inherits from
Methods (defined here)
- # append_features
- # class
- # extended
- # inspect
- # prepend_features
- self. new
Private methods (3)
Show private methods Implementation detail — not part of the public API.
Methods (inherited)
From Module
(27)
- # alias_attribute
- # anonymous?
- # attr_internal
- # attr_internal_accessor
- # attr_internal_reader
- # attr_internal_writer
- # cattr_accessor
- # cattr_reader
- # cattr_writer
- # deep_dup
- # delegate
- # delegate_missing_to
- # deprecate
- # mattr_accessor
- # mattr_reader
- # mattr_writer
- # module_parent
- # module_parent_name
- # module_parents
- # redefine_method
- # redefine_singleton_method
- # remove_possible_method
- # remove_possible_singleton_method
- # silence_redefinition_of_method
- # thread_cattr_accessor
- # thread_mattr_accessor
- self. attr_internal_naming_format=
From Module::Concerning
(2)
- # concern
- # concerning
From Object
(17)
- # acts_like?
- # blank?
- # deep_dup
- # duplicable?
- # html_safe?
- # in?
- # instance_values
- # instance_variable_names
- # presence
- # presence_in
- # present?
- # to_param
- # to_query
- # try
- # try!
- # with
- # with_options
From ActiveSupport::Concern
(3)
- # class_methods
- # included
- # prepended
From ActiveSupport::NumericWithFormat
(2)
- # to_formatted_s
- # to_fs