Class: EndOfLife::Product
- Inherits:
-
Object
- Object
- EndOfLife::Product
- 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
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#search_query ⇒ Object
readonly
Returns the value of attribute search_query.
-
#version_detector ⇒ Object
readonly
Returns the value of attribute version_detector.
Class Method Summary collapse
Instance Method Summary collapse
- #eol_releases_at(date) ⇒ Object
-
#initialize(name, search_query, version_detector) ⇒ Product
constructor
A new instance of Product.
- #label ⇒ Object
- #latest_eol_release(at: Date.today) ⇒ Object
- #to_s ⇒ Object
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/end_of_life/product.rb', line 5 def name @name end |
#search_query ⇒ Object (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_detector ⇒ Object (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 |
#label ⇒ Object
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_s ⇒ Object
22 |
# File 'lib/end_of_life/product.rb', line 22 def to_s = label |