Class: EndOfLife::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/end_of_life/product.rb,
lib/end_of_life/product/release.rb

Defined Under Namespace

Modules: Registry Classes: Release

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, search_query, version_detector) ⇒ Product

Returns a new instance of Product.



7
8
9
10
11
# File 'lib/end_of_life/product.rb', line 7

def initialize(name, search_query, version_detector)
  @name = name.to_s.downcase
  @search_query = search_query
  @version_detector = version_detector
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/end_of_life/product.rb', line 5

def name
  @name
end

#search_queryObject (readonly)

Returns the value of attribute search_query.



5
6
7
# File 'lib/end_of_life/product.rb', line 5

def search_query
  @search_query
end

#version_detectorObject (readonly)

Returns the value of attribute version_detector.



5
6
7
# File 'lib/end_of_life/product.rb', line 5

def version_detector
  @version_detector
end

Class Method Details

.find(name) ⇒ Object



3
# File 'lib/end_of_life/product.rb', line 3

def self.find(name) = EndOfLife.find_product(name)

Instance Method Details

#eol_releases_at(date) ⇒ Object



13
14
15
# File 'lib/end_of_life/product.rb', line 13

def eol_releases_at(date)
  all_releases.filter { |release| release.eol_date <= date }
end

#labelObject



21
# File 'lib/end_of_life/product.rb', line 21

def label = name.capitalize

#latest_eol_release(at: Date.today) ⇒ Object



17
18
19
# File 'lib/end_of_life/product.rb', line 17

def latest_eol_release(at: Date.today)
  eol_releases_at(at).max
end

#to_sObject



22
# File 'lib/end_of_life/product.rb', line 22

def to_s = label