Class: ActiveSupport::Deprecation::DeprecatedConstantProxy

Inherits:
DeprecationProxy show all
Defined in:
activesupport/lib/active_support/deprecation/proxy_wrappers.rb

Overview

This DeprecatedConstantProxy transforms constant to deprecated constant.

OLD_CONST = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('OLD_CONST', 'NEW_CONST')
OLD_CONST = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('OLD_CONST', 'NEW_CONST', deprecator_instance)

When someone use old constant this will trigger warn method on deprecator_instance.

Default deprecator is ActiveSupport::Deprecation.

Direct Known Subclasses

Rails::DeprecatedConstant

Instance Method Summary collapse

Methods inherited from DeprecationProxy

#inspect, new

Constructor Details

#initialize(old_const, new_const, deprecator = ActiveSupport::Deprecation.instance) ⇒ DeprecatedConstantProxy

Returns a new instance of DeprecatedConstantProxy.



106
107
108
109
110
# File 'activesupport/lib/active_support/deprecation/proxy_wrappers.rb', line 106

def initialize(old_const, new_const, deprecator = ActiveSupport::Deprecation.instance)
  @old_const = old_const
  @new_const = new_const
  @deprecator = deprecator
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveSupport::Deprecation::DeprecationProxy

Instance Method Details

#classObject



112
113
114
# File 'activesupport/lib/active_support/deprecation/proxy_wrappers.rb', line 112

def class
  target.class
end