Module: Timetress::Holiday
Constant Summary
collapse
- JANUARY =
1
- FEBRUARY =
2
- MAY =
5
- NOVEMBER =
11
- DECEMBER =
12
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
120
121
122
123
124
125
126
127
128
|
# File 'lib/timetress/holiday.rb', line 120
def method_missing(method, *args, &block)
if method.to_s =~ /^next_(.*)$/
next_holiday($1, args.first)
elsif method.to_s =~ /^previous_(.*)$/
previous_holiday($1, args.first)
else
super
end
end
|
Instance Method Details
#ascension(year) ⇒ Object
34
35
36
|
# File 'lib/timetress/holiday.rb', line 34
def ascension(year)
easter_sunday(year) + 39
end
|
#boxing_day(year) ⇒ Object
54
55
56
|
# File 'lib/timetress/holiday.rb', line 54
def boxing_day(year)
Date.new(year, DECEMBER, 26)
end
|
#christmas(year) ⇒ Object
50
51
52
|
# File 'lib/timetress/holiday.rb', line 50
def christmas(year)
Date.new(year, DECEMBER, 25)
end
|
#christmas_eve(year) ⇒ Object
46
47
48
|
# File 'lib/timetress/holiday.rb', line 46
def christmas_eve(year)
Date.new(year, DECEMBER, 24)
end
|
#easter_monday(year) ⇒ Object
30
31
32
|
# File 'lib/timetress/holiday.rb', line 30
def easter_monday(year)
easter_sunday(year) + 1
end
|
#easter_sunday(year) ⇒ Object
26
27
28
|
# File 'lib/timetress/holiday.rb', line 26
def easter_sunday(year)
Timetress::EASTER[year]
end
|
#fathersday(year) ⇒ Object
70
71
72
|
# File 'lib/timetress/holiday.rb', line 70
def fathersday(year)
raise NotImplementedError.new localization_error_message
end
|
#good_friday(year) ⇒ Object
22
23
24
|
# File 'lib/timetress/holiday.rb', line 22
def good_friday(year)
easter_sunday(year) - 2
end
|
#labour_day(year) ⇒ Object
Also known as:
labor_day
74
75
76
|
# File 'lib/timetress/holiday.rb', line 74
def labour_day(year)
raise NotImplementedError.new localization_error_message
end
|
#maundy_thursday(year) ⇒ Object
18
19
20
|
# File 'lib/timetress/holiday.rb', line 18
def maundy_thursday(year)
easter_sunday(year) - 3
end
|
#mothersday(year) ⇒ Object
66
67
68
|
# File 'lib/timetress/holiday.rb', line 66
def mothersday(year)
raise NotImplementedError.new localization_error_message
end
|
#national_holiday(year) ⇒ Object
79
80
81
|
# File 'lib/timetress/holiday.rb', line 79
def national_holiday(year)
raise NotImplementedError.new localization_error_message
end
|
#new_years_day(year) ⇒ Object
10
11
12
|
# File 'lib/timetress/holiday.rb', line 10
def new_years_day(year)
Date.new(year, JANUARY, 1)
end
|
#new_years_eve(year) ⇒ Object
58
59
60
|
# File 'lib/timetress/holiday.rb', line 58
def new_years_eve(year)
Date.new(year, DECEMBER, 31)
end
|
#official_holidays(year) ⇒ Object
62
63
64
|
# File 'lib/timetress/holiday.rb', line 62
def official_holidays(year)
raise NotImplementedError.new localization_error_message
end
|
#pentecost_monday(year) ⇒ Object
42
43
44
|
# File 'lib/timetress/holiday.rb', line 42
def pentecost_monday(year)
easter_sunday(year) + 50
end
|
#pentecost_sunday(year) ⇒ Object
38
39
40
|
# File 'lib/timetress/holiday.rb', line 38
def pentecost_sunday(year)
easter_sunday(year) + 49
end
|
#valentines_day(year) ⇒ Object
14
15
16
|
# File 'lib/timetress/holiday.rb', line 14
def valentines_day(year)
Date.new(year, FEBRUARY, 14)
end
|