Class: Scheduling::Yearly
- Inherits:
-
Struct
- Object
- Struct
- Scheduling::Yearly
- Defined in:
- lib/scheduling/regularity/yearly.rb
Instance Attribute Summary collapse
-
#mday ⇒ Object
Returns the value of attribute mday.
-
#month ⇒ Object
Returns the value of attribute month.
Instance Method Summary collapse
Instance Attribute Details
#mday ⇒ Object
Returns the value of attribute mday
4 5 6 |
# File 'lib/scheduling/regularity/yearly.rb', line 4 def mday @mday end |
#month ⇒ Object
Returns the value of attribute month
4 5 6 |
# File 'lib/scheduling/regularity/yearly.rb', line 4 def month @month end |
Instance Method Details
#occurances(time_range) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/scheduling/regularity/yearly.rb', line 5 def occurances time_range raise RangeDecreasingError if time_range.decreasing? cur = Date.new(time_range.min.year, month, mday) start = time_range.min if cur < start cur = cur.next_year end occurances = [] stop = time_range.last if time_range.exclude_end? stop -= 1 end while cur <= stop occurances.push cur cur = cur.next_year end return occurances end |