Class: EndOfLife::Product::Release
- Inherits:
-
Object
- Object
- EndOfLife::Product::Release
- Includes:
- Comparable
- Defined in:
- lib/end_of_life/product/release.rb
Constant Summary collapse
- ZERO =
Gem::Version.new("0")
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eol?(at: Date.today) ⇒ Boolean
-
#initialize(product:, version:, eol_date: nil) ⇒ Release
constructor
A new instance of Release.
- #to_s ⇒ Object
- #zero? ⇒ Boolean
Constructor Details
#initialize(product:, version:, eol_date: nil) ⇒ Release
Returns a new instance of Release.
8 9 10 11 12 |
# File 'lib/end_of_life/product/release.rb', line 8 def initialize(product:, version:, eol_date: nil) product = Product.find(product.to_s) eol_date = Date.parse(eol_date.to_s) if eol_date super(product:, eol_date:, version: Gem::Version.new(version)) end |
Class Method Details
.ruby(version, eol_date: nil) ⇒ Object
6 |
# File 'lib/end_of_life/product/release.rb', line 6 def self.ruby(version, eol_date: nil) = new(product: "ruby", version:, eol_date:) |
Instance Method Details
#<=>(other) ⇒ Object
25 |
# File 'lib/end_of_life/product/release.rb', line 25 def <=>(other) = version <=> other.version |
#eol?(at: Date.today) ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/end_of_life/product/release.rb', line 14 def eol?(at: Date.today) if eol_date eol_date <= at else self <= product.latest_eol_release(at: at) end end |
#to_s ⇒ Object
27 |
# File 'lib/end_of_life/product/release.rb', line 27 def to_s = version.to_s |
#zero? ⇒ Boolean
23 |
# File 'lib/end_of_life/product/release.rb', line 23 def zero? = version == ZERO |