Class: ReleaseCalculator
- Inherits:
-
Object
- Object
- ReleaseCalculator
- Defined in:
- lib/gitlab_releases/release_calculator.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_version:, release_date:) ⇒ ReleaseCalculator
constructor
A new instance of ReleaseCalculator.
Constructor Details
#initialize(current_version:, release_date:) ⇒ ReleaseCalculator
Returns a new instance of ReleaseCalculator.
7 8 9 10 11 |
# File 'lib/gitlab_releases/release_calculator.rb', line 7 def initialize(current_version:, release_date:) @current_version = current_version @release_date = release_date @release_dates = {} end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gitlab_releases/release_calculator.rb', line 13 def execute @release_dates[current_version] = release_date.strftime('%Y-%m-%d') next_version = calculate_release_version(current_version, release_date) period(release_date, release_date + 1.year).each do |candidate_date| @release_dates[next_version] = calculate_release_date(next_version, candidate_date) next_version = calculate_release_version(next_version, candidate_date) end @release_dates end |