class ActiveSupport::Deprecation::DeprecatedObjectProxy

This DeprecatedObjectProxy transforms object to deprecated object.

@old_object = DeprecatedObjectProxy.new(Object.new, "Don't use this object anymore!")
@old_object = DeprecatedObjectProxy.new(Object.new, "Don't use this object anymore!", deprecator_instance)

When someone executes any method except inspect on proxy object this will trigger warn method on deprecator_instance.

Default deprecator is ActiveSupport::Deprecation

Public Class Methods

new(object, message, deprecator = ActiveSupport::Deprecation.instance) click to toggle source
# File lib/active_support/deprecation/proxy_wrappers.rb, line 38
def initialize(object, message, deprecator = ActiveSupport::Deprecation.instance)
  @object = object
  @message = message
  @deprecator = deprecator
end

Private Instance Methods

target() click to toggle source
# File lib/active_support/deprecation/proxy_wrappers.rb, line 45
def target
  @object
end
warn(callstack, called, args) click to toggle source
# File lib/active_support/deprecation/proxy_wrappers.rb, line 49
def warn(callstack, called, args)
  @deprecator.warn(@message, callstack)
end