DeprecatedObjectProxy
将对象转换为已弃用对象。它接受一个对象、一个弃用消息和一个弃用器。
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>"
方法
- N
类公共方法
new(object, message, deprecator) 链接
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/proxy_wrappers.rb, line 39 def initialize(object, message, deprecator) @object = object @message = message @deprecator = deprecator end