Method: Selenium::WebDriver::Logger#deprecate

Defined in:
lib/selenium/webdriver/common/logger.rb

#deprecate(old, new = nil, id: [], reference: '') { ... } ⇒ Object

Marks code as deprecated with/without replacement.

Parameters:

  • old (String)
  • new (String, nil) (defaults to: nil)
  • id (Symbol, Array<Symbol>) (defaults to: [])
  • reference (String) (defaults to: '')

Yields:

  • appends additional message to end of provided template

[View source]

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/selenium/webdriver/common/logger.rb', line 164

def deprecate(old, new = nil, id: [], reference: '', &block)
  id = Array(id)
  return if @ignored.include?(:deprecations)

  id << :deprecations if @allowed.include?(:deprecations)

  message = "[DEPRECATION] #{old} is deprecated"
  message << if new
               ". Use #{new} instead."
             else
               ' and will be removed in a future release.'
             end
  message << " See explanation for this deprecation: #{reference}." unless reference.empty?

  discard_or_log(:warn, message, id, &block)
end