class Enumdate::DateEnumerator::MonthlyByDay

Enumerate monthly dates by day like: 4th Tue

Public Class Methods

new(first_date:, nth:, wday:, interval: 1) click to toggle source
Calls superclass method Enumdate::DateEnumerator::Base::new
# File lib/enumdate/date_enumerator.rb, line 154
def initialize(first_date:, nth:, wday:, interval: 1)
  super(first_date: first_date, interval: interval)
  @nth, @wday = nth, wday
end

Private Instance Methods

frame_manager() click to toggle source
# File lib/enumdate/date_enumerator.rb, line 161
def frame_manager
  DateFrame::Monthly
end
occurrence_in_frame(date) click to toggle source
# File lib/enumdate/date_enumerator.rb, line 165
def occurrence_in_frame(date)
  make_date_by_day(year: date.year, month: date.month, nth: @nth, wday: @wday)
rescue Date::Error
  nil
end