class DelayedDeprecation

Constants

VERSION

Attributes

deprecation_horizon[R]

Public Class Methods

new(reason, owner:, reconsider_after: nil) { || ... } click to toggle source
# File lib/delayed_deprecation.rb, line 8
def initialize(reason, owner:, reconsider_after: nil, &block)
  @reason = reason
  @owner = owner
  @reconsider_after = reconsider_after
  @deprecation_horizon = reconsider_after

  yield if block

  warn(message) if active?
end

Public Instance Methods

behavior() click to toggle source
# File lib/delayed_deprecation.rb, line 19
def behavior
  ActiveSupport::Deprecation.behavior
end

Private Instance Methods

active?(date = Date.today) click to toggle source
# File lib/delayed_deprecation.rb, line 27
def active?(date = Date.today)
  !@reconsider_after || @reconsider_after <= date
end
message() click to toggle source
# File lib/delayed_deprecation.rb, line 31
def message
  "#{@reason} [Owner: #{@owner}]"
end