Sha256: 80dfa5570a549e05bce761ade59d85a5404b5e685c54bdda056308f2a15f562e
Contents?: true
Size: 518 Bytes
Versions: 2
Compression:
Stored size: 518 Bytes
Contents
require 'date' module Scheduling class Yearly < Struct.new(:month, :mday) 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scheduling-0.1.2 | lib/scheduling/regularity/yearly.rb |
scheduling-0.1.1 | lib/scheduling/regularity/yearly.rb |