Class: ActiveSupport::Deprecation::DeprecatedObjectProxy

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

Overview

DeprecatedObjectProxy transforms an object into a deprecated one. It takes an object, a deprecation message and optionally a deprecator. The deprecator defaults to ActiveSupport::Deprecator if none is specified.

deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated")
# => #<Object:0x007fb9b34c34b0>

deprecated_object.to_s
DEPRECATION WARNING: This object is now deprecated.
(Backtrace)
# => "#<Object:0x007fb9b34c34b0>"

Instance Method Summary collapse

Methods inherited from DeprecationProxy

#inspect, new

Constructor Details

#initialize(object, message, deprecator = ActiveSupport::Deprecation.instance) ⇒ DeprecatedObjectProxy

Returns a new instance of DeprecatedObjectProxy.



42
43
44
45
46
# File 'lib/active_support/deprecation/proxy_wrappers.rb', line 42

def initialize(object, message, deprecator = ActiveSupport::Deprecation.instance)
  @object = object
  @message = message
  @deprecator = deprecator
end

Dynamic Method Handling

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