class Chronic::Season
Attributes
end[R]
start[R]
Public Class Methods
find_next_season(season, pointer)
click to toggle source
# File lib/chronic/season.rb, line 12 def self.find_next_season(season, pointer) lookup = [:spring, :summer, :autumn, :winter] next_season_num = (lookup.index(season) + 1 * pointer) % 4 lookup[next_season_num] end
new(start_date, end_date)
click to toggle source
# File lib/chronic/season.rb, line 7 def initialize(start_date, end_date) @start = start_date @end = end_date end
season_after(season)
click to toggle source
# File lib/chronic/season.rb, line 18 def self.season_after(season) find_next_season(season, +1) end
season_before(season)
click to toggle source
# File lib/chronic/season.rb, line 22 def self.season_before(season) find_next_season(season, -1) end