class Feriados::Rules::FixWeekDay

Attributes

month[R]
wday[R]
week[R]

Public Class Methods

new(week, wday, month, name = nil) click to toggle source
Calls superclass method
# File lib/feriados/rules/fix_week_day.rb, line 4
def initialize(week, wday, month, name = nil)
  super(name)
  @week = week
  @wday = wday
  @month = month
end

Public Instance Methods

holiday?(date) click to toggle source
# File lib/feriados/rules/fix_week_day.rb, line 11
def holiday?(date)
  date_from_week = (date.day - 1) / 7 + 1
  wday == date.wday && month == date.month && week == date_from_week
end

Protected Instance Methods

state() click to toggle source
# File lib/feriados/rules/fix_week_day.rb, line 20
def state
  [week, wday, month]
end