class Montrose::Rule::NthDayOfYear::YearDay

Public Class Methods

new(time) click to toggle source
# File lib/montrose/rule/nth_day_of_year.rb, line 37
def initialize(time)
  @time = time
end

Public Instance Methods

first_wday() click to toggle source
# File lib/montrose/rule/nth_day_of_year.rb, line 45
def first_wday
  @time.beginning_of_year.wday
end
nth_day() click to toggle source
# File lib/montrose/rule/nth_day_of_year.rb, line 41
def nth_day
  @time.yday
end
total_days() click to toggle source
# File lib/montrose/rule/nth_day_of_year.rb, line 49
def total_days
  days_in_year(@time)
end

Private Instance Methods

days_in_year(time) click to toggle source

Get the days in the month for +time

# File lib/montrose/rule/nth_day_of_year.rb, line 56
def days_in_year(time)
  date = time.to_date
  ((date + 1.year) - date).to_i
end