Module: Timetress::Norway::Holiday

Includes:
Holiday
Included in:
Timetress::Norway
Defined in:
lib/timetress/norway/holiday.rb

Constant Summary

Constants included from Holiday

Holiday::DECEMBER, Holiday::FEBRUARY, Holiday::JANUARY, Holiday::MAY, Holiday::NOVEMBER

Instance Method Summary collapse

Methods included from Holiday

#ascension, #boxing_day, #christmas_eve, #easter_monday, #easter_sunday, #good_friday, #maundy_thursday, #new_years_day, #new_years_eve, #pentecost_monday, #pentecost_sunday, #valentines_day

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Timetress::Holiday

Instance Method Details

#christmas(year) ⇒ Object



23
24
25
# File 'lib/timetress/norway/holiday.rb', line 23

def christmas(year)
  raise AmbiguousHolidayError.new("Do you mean `christmas_eve` or `first_day_of_christmas`?")
end

#fathersday(year) ⇒ Object



10
11
12
# File 'lib/timetress/norway/holiday.rb', line 10

def fathersday(year)
  second_sunday_in(NOVEMBER, year)
end

#first_day_of_christmas(year) ⇒ Object



27
28
29
# File 'lib/timetress/norway/holiday.rb', line 27

def first_day_of_christmas(year)
  Date.new(year, DECEMBER, 25)
end

#labour_day(year) ⇒ Object Also known as: labor_day



14
15
16
# File 'lib/timetress/norway/holiday.rb', line 14

def labour_day(year)
  Date.new(year, MAY, 1)
end

#mothersday(year) ⇒ Object



6
7
8
# File 'lib/timetress/norway/holiday.rb', line 6

def mothersday(year)
  second_sunday_in(FEBRUARY, year)
end

#national_holiday(year) ⇒ Object



19
20
21
# File 'lib/timetress/norway/holiday.rb', line 19

def national_holiday(year)
  Date.new(year, MAY, 17)
end

#official_holidays(year) ⇒ Object Also known as: public_holidays, legal_holidays



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/timetress/norway/holiday.rb', line 33

def official_holidays(year)
  [
    new_years_day(year),
    maundy_thursday(year),
    good_friday(year),
    easter_sunday(year),
    easter_monday(year),
    labor_day(year),
    national_holiday(year),
    ascension(year),
    pentecost_sunday(year),
    pentecost_monday(year),
    first_day_of_christmas(year),
    boxing_day(year)
  ]
end