Class: Montrose::Rule::NthDayOfMonth::MonthDay

Inherits:
Object
  • Object
show all
Defined in:
lib/montrose/rule/nth_day_of_month.rb

Instance Method Summary collapse

Constructor Details

#initialize(time) ⇒ MonthDay

Returns a new instance of MonthDay


38
39
40
# File 'lib/montrose/rule/nth_day_of_month.rb', line 38

def initialize(time)
  @time = time
end

Instance Method Details

#first_wdayObject


46
47
48
# File 'lib/montrose/rule/nth_day_of_month.rb', line 46

def first_wday
  @time.beginning_of_month.wday
end

#nth_dayObject


42
43
44
# File 'lib/montrose/rule/nth_day_of_month.rb', line 42

def nth_day
  @time.mday
end

#total_daysObject


50
51
52
# File 'lib/montrose/rule/nth_day_of_month.rb', line 50

def total_days
  ::Montrose::Utils.days_in_month(@time.month, @time.year)
end