Class: ActiveSupport::Deprecation::DeprecatedObjectProxy
- Inherits:
-
DeprecationProxy
- Object
- DeprecationProxy
- ActiveSupport::Deprecation::DeprecatedObjectProxy
- Defined in:
- activesupport/lib/active_support/deprecation/proxy_wrappers.rb
Overview
DeprecatedObjectProxy transforms an object into a deprecated one. It takes an object, a deprecation message, and a deprecator.
deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated", ActiveSupport::Deprecation.new)
# => #<Object:0x007fb9b34c34b0>
deprecated_object.to_s
DEPRECATION WARNING: This object is now deprecated.
(Backtrace)
# => "#<Object:0x007fb9b34c34b0>"
Instance Method Summary collapse
-
#initialize(object, message, deprecator = nil) ⇒ DeprecatedObjectProxy
constructor
A new instance of DeprecatedObjectProxy.
Methods inherited from DeprecationProxy
Constructor Details
#initialize(object, message, deprecator = nil) ⇒ DeprecatedObjectProxy
Returns a new instance of DeprecatedObjectProxy.
39 40 41 42 43 44 |
# File 'activesupport/lib/active_support/deprecation/proxy_wrappers.rb', line 39 def initialize(object, , deprecator = nil) @object = object @message = ActiveSupport.deprecator.warn("DeprecatedObjectProxy without a deprecator is deprecated") unless deprecator @deprecator = deprecator || ActiveSupport::Deprecation._instance end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveSupport::Deprecation::DeprecationProxy