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.
10 11 12 13 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 10 def initialize(myStart, myEnd) @start = myStart @end = myEnd end |
Instance Attribute Details
#end ⇒ Object (readonly)
Returns the value of attribute end.
8 9 10 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 8 def end @end end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
8 9 10 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 8 def start @start end |
Class Method Details
.find_next_season(season, pointer) ⇒ Object
15 16 17 18 19 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 15 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
21 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 21 def self.season_after(season); find_next_season(season, +1); end |
.season_before(season) ⇒ Object
22 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 22 def self.season_before(season); find_next_season(season, -1); end |