Class: Chronic::Season
- Inherits:
-
Object
- Object
- Chronic::Season
- Defined in:
- lib/chronic/repeaters/repeater_season.rb
Instance Attribute Summary collapse
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Class Method Summary collapse
- .find_next_season(season, pointer) ⇒ Object
- .season_after(season) ⇒ Object
- .season_before(season) ⇒ Object
Instance Method Summary collapse
-
#initialize(myStart, myEnd) ⇒ Season
constructor
A new instance of Season.
Constructor Details
#initialize(myStart, myEnd) ⇒ Season
Returns a new instance of Season.
5 6 7 8 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 5 def initialize(myStart, myEnd) @start = myStart @end = myEnd end |
Instance Attribute Details
#end ⇒ Object (readonly)
Returns the value of attribute end.
3 4 5 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 3 def end @end end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
3 4 5 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 3 def start @start end |
Class Method Details
.find_next_season(season, pointer) ⇒ Object
10 11 12 13 14 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 10 def self.find_next_season(season, pointer) lookup = {:spring => 0, :summer => 1, :autumn => 2, :winter => 3} next_season_num = (lookup[season]+1*pointer) % 4 lookup.invert[next_season_num] end |
.season_after(season) ⇒ Object
16 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 16 def self.season_after(season); find_next_season(season, +1); end |
.season_before(season) ⇒ Object
17 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 17 def self.season_before(season); find_next_season(season, -1); end |