Class: DelayedDeprecation

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Deprecation::Reporting
Defined in:
lib/delayed_deprecation.rb,
lib/delayed_deprecation/version.rb

Constant Summary collapse

VERSION =
"0.2.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, owner:, reconsider_after: nil, &block) ⇒ DelayedDeprecation

Returns a new instance of DelayedDeprecation.



8
9
10
11
12
13
14
15
16
17
# 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

Instance Attribute Details

#deprecation_horizonObject (readonly)

Returns the value of attribute deprecation_horizon.



23
24
25
# File 'lib/delayed_deprecation.rb', line 23

def deprecation_horizon
  @deprecation_horizon
end

Instance Method Details

#behaviorObject



19
20
21
# File 'lib/delayed_deprecation.rb', line 19

def behavior
  ActiveSupport::Deprecation.behavior
end