Spec-Zone.ru › Ruby on Rails 7.1

класс ActiveSupport::Deprecation::DeprecatedObjectProxy

Родитель:
ActiveSupport::Deprecation::DeprecationProxy

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>"

Публичные методы класса

new(object, message, deprecator = nil) Показать исходный код
# File activesupport/lib/active_support/deprecation/proxy_wrappers.rb, line 39
def initialize(object, message, deprecator = nil)
  @object = object
  @message = message
  ActiveSupport.deprecator.warn("DeprecatedObjectProxy without a deprecator is deprecated") unless deprecator
  @deprecator = deprecator || ActiveSupport::Deprecation._instance
end

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API