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

Version Path
gitlab-chronic-0.10.6 lib/chronic/season.rb
gitlab-chronic-0.10.5 lib/chronic/season.rb
gitlab-chronic-0.10.4 lib/chronic/season.rb
gitlab-chronic-0.10.3 lib/chronic/season.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/season.rb
chronic-mmlac-0.10.2.1 lib/chronic/season.rb
chronic-0.10.2 lib/chronic/season.rb
chronic-0.10.1 lib/chronic/season.rb
chronic-0.10.0 lib/chronic/season.rb
chronic-0.9.1 lib/chronic/season.rb
chronic-0.9.0 lib/chronic/season.rb
Hokkaido-0.1.5 chronic/lib/chronic/season.rb
Hokkaido-0.1.4 chronic/lib/chronic/season.rb
Hokkaido-0.1.3 chronic/lib/chronic/season.rb
Hokkaido-0.1.2 chronic/lib/chronic/season.rb
Hokkaido-0.1.1 chronic/lib/chronic/season.rb
Hokkaido-0.1.0 chronic/lib/chronic/season.rb
Hokkaido-0.0.9 chronic/lib/chronic/season.rb
Hokkaido-0.0.6 chronic/lib/chronic/season.rb
Hokkaido-0.0.5 chronic/lib/chronic/season.rb