class ActiveSupport::Deprecation::DeprecatedObjectProxy
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>"
Public Class Methods
Source
# File lib/active_support/deprecation/proxy_wrappers.rb, line 40 def initialize(object, message, deprecator = ActiveSupport::Deprecation.instance) @object = object @message = message @deprecator = deprecator end
Private Instance Methods
Source
# File lib/active_support/deprecation/proxy_wrappers.rb, line 47 def target @object end
Source
# File lib/active_support/deprecation/proxy_wrappers.rb, line 51 def warn(callstack, called, args) @deprecator.warn(@message, callstack) end