module Enumdate

Enumerator for recurring dates

Constants

VERSION

Public Class Methods

daily(first_date, interval: 1) click to toggle source

@return [DateEnumerator::Daily]

# File lib/enumdate.rb, line 78
def daily(first_date, interval: 1)
  DateEnumerator::Daily.new(
    first_date: first_date,
    interval: interval
  )
end
monthly_by_day(first_date, nth: nil, wday: nil, interval: 1) click to toggle source

@return [DateEnumerator::MonthlyByDay]

# File lib/enumdate.rb, line 55
def monthly_by_day(first_date, nth: nil, wday: nil, interval: 1)
  nth  ||= (first_date.mday + 6) / 7
  wday ||= first_date.wday
  DateEnumerator::MonthlyByDay.new(
    first_date: first_date,
    nth: nth,
    wday: wday,
    interval: interval
  )
end
monthly_by_monthday(first_date, mday: nil, interval: 1) click to toggle source

@return [DateEnumerator::MonthlyByMonthday]

# File lib/enumdate.rb, line 45
def monthly_by_monthday(first_date, mday: nil, interval: 1)
  mday ||= first_date.mday
  DateEnumerator::MonthlyByMonthday.new(
    first_date: first_date,
    mday: mday,
    interval: interval
  )
end
weekly(first_date, wday: nil, wkst: 1, interval: 1) click to toggle source

@return [DateEnumerator::Weekly]

# File lib/enumdate.rb, line 67
def weekly(first_date, wday: nil, wkst: 1, interval: 1)
  wday ||= first_date.wday
  DateEnumerator::Weekly.new(
    first_date: first_date,
    wday: wday,
    wkst: wkst,
    interval: interval
  )
end
yearly_by_day(first_date, month: nil, nth: nil, wday: nil, interval: 1) click to toggle source

@return [DateEnumerator::YearlyByDay]

# File lib/enumdate.rb, line 31
def yearly_by_day(first_date, month: nil, nth: nil, wday: nil, interval: 1)
  month ||= first_date.month
  nth   ||= (first_date.mday + 6) / 7
  wday  ||= first_date.wday
  DateEnumerator::YearlyByDay.new(
    first_date: first_date,
    month: month,
    nth: nth,
    wday: wday,
    interval: interval
  )
end
yearly_by_monthday(first_date, month: nil, mday: nil, interval: 1) click to toggle source

@return [DateEnumerator::YearlyByMonthday]

# File lib/enumdate.rb, line 19
def yearly_by_monthday(first_date, month: nil, mday: nil, interval: 1)
  month ||= first_date.month
  mday  ||= first_date.mday
  DateEnumerator::YearlyByMonthday.new(
    first_date: first_date,
    month: month,
    mday: mday,
    interval: interval
  )
end