Class: Cocooned::Deprecation

Inherits:
ActiveSupport::Deprecation
  • Object
show all
Defined in:
lib/cocooned/deprecation.rb

Overview

Custom deprecator to use with ActiveSupport::Deprecation methods

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deprecation_horizon = nil, gem_name = 'Cocooned') ⇒ Deprecation

Returns a new instance of Deprecation.



14
15
16
17
# File 'lib/cocooned/deprecation.rb', line 14

def initialize(deprecation_horizon = nil, gem_name = 'Cocooned')
  deprecation_horizon ||= format('%<major>d.0', major: Gem::Version.new(Cocooned::VERSION).segments.first + 1)
  super
end

Class Method Details

.[](deprecation_horizon = nil) ⇒ Object



10
11
12
# File 'lib/cocooned/deprecation.rb', line 10

def self.[](deprecation_horizon = nil)
  @deprecators[deprecation_horizon] ||= new(deprecation_horizon)
end