Sha256: 54856e5f96f52d66ac945a7162c93045d567ef0554434423b80e4c6211549b31
Contents?: true
Size: 598 Bytes
Versions: 2
Compression:
Stored size: 598 Bytes
Contents
require 'date' module Scheduling class Monthly def initialize mday @mday = mday if mday > 28 @mday = 28 end end def occurances date_range raise RangeDecreasingError if date_range.decreasing? cur = Date.new(date_range.min.year, date_range.min.month, @mday) start = date_range.min if cur < start cur = cur.next_month end occurances = [] stop = date_range.last if date_range.exclude_end? stop -= 1 end while cur <= stop occurances.push cur cur = cur.next_month 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/monthly.rb |
scheduling-0.1.1 | lib/scheduling/regularity/monthly.rb |