Class: EOL::Models::Cycle

Inherits:
Object
  • Object
show all
Defined in:
lib/eol_rb/models/cycle.rb

Overview

EOL Cycle model endoflife.date/docs/api

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(specs) ⇒ Cycle

Returns a new instance of Cycle.



9
10
11
12
13
14
15
16
# File 'lib/eol_rb/models/cycle.rb', line 9

def initialize(specs)
  @version = Gem::Version.new(specs.fetch("cycle"))
  @eol = parse_eol(specs.fetch("eol"))
  @latest = Gem::Version.new(specs.fetch("latest"))
  @latest_release_date = Date.parse(specs.fetch("latestReleaseDate"))
  @release_date = Date.parse(specs.fetch("releaseDate"))
  @lts = specs.fetch("lts")
end

Instance Attribute Details

#eolObject (readonly)

Returns the value of attribute eol.



7
8
9
# File 'lib/eol_rb/models/cycle.rb', line 7

def eol
  @eol
end

#latestObject (readonly)

Returns the value of attribute latest.



7
8
9
# File 'lib/eol_rb/models/cycle.rb', line 7

def latest
  @latest
end

#latest_release_dateObject (readonly)

Returns the value of attribute latest_release_date.



7
8
9
# File 'lib/eol_rb/models/cycle.rb', line 7

def latest_release_date
  @latest_release_date
end

#ltsObject (readonly)

Returns the value of attribute lts.



7
8
9
# File 'lib/eol_rb/models/cycle.rb', line 7

def lts
  @lts
end

#release_dateObject (readonly)

Returns the value of attribute release_date.



7
8
9
# File 'lib/eol_rb/models/cycle.rb', line 7

def release_date
  @release_date
end

#versionObject (readonly)

Returns the value of attribute version.



7
8
9
# File 'lib/eol_rb/models/cycle.rb', line 7

def version
  @version
end

Instance Method Details

#supported?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
# File 'lib/eol_rb/models/cycle.rb', line 18

def supported?
  return !eol if [true, false].include? eol

  @eol > Time.now.to_date
end