class Dont::Deprecation

Contains info about the deprecated method being called

Attributes

new_method[R]
old_method[R]
subject[R]

Public Class Methods

new(subject:, old_method:, new_method: nil) click to toggle source
# File lib/dont.rb, line 112
def initialize(subject:, old_method:, new_method: nil)
  @subject = subject
  @new_method = new_method
  @old_method = old_method
end

Public Instance Methods

message() click to toggle source

A message saying that the old_method is deprecated. It also mentions the new_method if provided.

@return [String]

# File lib/dont.rb, line 122
def message
  klass = subject.class.name
  if new_method && !new_method.empty?
    "DEPRECATED: Don't use #{klass}##{old_method}. It's deprecated in favor of #{new_method}."
  else
    "DEPRECATED: Don't use #{klass}##{old_method}. It's deprecated."
  end
end