Sha256: 4754fcf804f603240ec900af5c6b0717b58af7fc7651a73ced27e6dbf9904089
Contents?: true
Size: 542 Bytes
Versions: 30
Compression:
Stored size: 542 Bytes
Contents
module Chronic class Season attr_reader :start attr_reader :end def initialize(start_date, end_date) @start = start_date @end = end_date end 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 def self.season_after(season) find_next_season(season, +1) end def self.season_before(season) find_next_season(season, -1) end end end
Version data entries
30 entries across 30 versions & 7 rubygems