Module: CalendariumRomanum::Temporale::Dates
- Extended by:
- Dates
- Includes:
- DateHelper
- Included in:
- Dates
- Defined in:
- lib/calendarium-romanum/temporale/dates.rb
Overview
Provides methods computing dates of movable feasts and utilities for common computations of relative dates
Constant Summary
Constants included
from DateHelper
CalendariumRomanum::Temporale::DateHelper::WEEKDAYS
Instance Method Summary
collapse
Methods included from DateHelper
#friday_after, #friday_before, #monday_after, #monday_before, #octave_of, #saturday_after, #saturday_before, #sunday_after, #sunday_before, #thursday_after, #thursday_before, #tuesday_after, #tuesday_before, #wednesday_after, #wednesday_before, #weekday_after, #weekday_before
Instance Method Details
#ascension(year, sunday: false) ⇒ Date
107
108
109
110
111
112
113
114
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 107
def ascension(year, sunday: false)
if sunday
return easter_sunday(year) + 6 * WEEK
end
pentecost(year) - 10
end
|
#ash_wednesday(year) ⇒ Date
60
61
62
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 60
def ash_wednesday(year)
easter_sunday(year) - (6 * WEEK + 4)
end
|
#baptism_of_lord(year, epiphany_on_sunday: false) ⇒ Date
50
51
52
53
54
55
56
57
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 50
def baptism_of_lord(year, epiphany_on_sunday: false)
e = epiphany(year, sunday: epiphany_on_sunday)
if e.day > 6
e + 1
else
sunday_after e
end
end
|
#christ_king(year) ⇒ Date
152
153
154
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 152
def christ_king(year)
first_advent_sunday(year + 1) - 7
end
|
#corpus_christi(year, sunday: false) ⇒ Date
127
128
129
130
131
132
133
134
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 127
def corpus_christi(year, sunday: false)
if sunday
return holy_trinity(year) + WEEK
end
holy_trinity(year) + 4
end
|
#easter_sunday(year) ⇒ Date
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 65
def easter_sunday(year)
year += 1
golden_number = (year % 19) + 1
dominical_number = (year + (year / 4) - (year / 100) + (year / 400)) % 7
solar_correction = (year - 1600) / 100 - (year - 1600) / 400
lunar_correction = (((year - 1400) / 100) * 8) / 25
paschal_full_moon = (3 - 11 * golden_number + solar_correction - lunar_correction) % 30
dominical_number += 7 until dominical_number > 0
paschal_full_moon += 30 until paschal_full_moon > 0
paschal_full_moon -= 1 if (paschal_full_moon == 29) || ((paschal_full_moon == 28) && golden_number > 11)
difference = (4 - paschal_full_moon - dominical_number) % 7
difference += 7 if difference < 0
day_easter = paschal_full_moon + difference + 1
if day_easter < 11
return Date.new(year, 3, day_easter + 21)
else
return Date.new(year, 4, day_easter - 10)
end
end
|
#epiphany(year, sunday: false) ⇒ Date
38
39
40
41
42
43
44
45
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 38
def epiphany(year, sunday: false)
if sunday
return sunday_after(Date.new(year + 1, 1, 1))
end
Date.new(year + 1, 1, 6)
end
|
#first_advent_sunday(year) ⇒ Date
10
11
12
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 10
def first_advent_sunday(year)
sunday_before(nativity(year)) - 3 * WEEK
end
|
#good_friday(year) ⇒ Date
97
98
99
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 97
def good_friday(year)
easter_sunday(year) - 2
end
|
#holy_family(year) ⇒ Date
21
22
23
24
25
26
27
28
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 21
def holy_family(year)
xmas = nativity(year)
if xmas.sunday?
return Date.new(year, 12, 30)
else
sunday_after(xmas)
end
end
|
#holy_saturday(year) ⇒ Date
102
103
104
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 102
def holy_saturday(year)
easter_sunday(year) - 1
end
|
#holy_trinity(year) ⇒ Date
122
123
124
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 122
def holy_trinity(year)
octave_of(pentecost(year))
end
|
#immaculate_heart(year) ⇒ Date
147
148
149
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 147
def immaculate_heart(year)
pentecost(year) + 20
end
|
#mother_of_church(year) ⇒ Date
142
143
144
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 142
def mother_of_church(year)
pentecost(year) + 1
end
|
#mother_of_god(year) ⇒ Date
31
32
33
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 31
def mother_of_god(year)
octave_of(nativity(year))
end
|
#nativity(year) ⇒ Date
16
17
18
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 16
def nativity(year)
Date.new(year, 12, 25)
end
|
#palm_sunday(year) ⇒ Date
92
93
94
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 92
def palm_sunday(year)
easter_sunday(year) - 7
end
|
#pentecost(year) ⇒ Date
117
118
119
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 117
def pentecost(year)
easter_sunday(year) + 7 * WEEK
end
|
#sacred_heart(year) ⇒ Date
137
138
139
|
# File 'lib/calendarium-romanum/temporale/dates.rb', line 137
def sacred_heart(year)
corpus_christi(year) + 8
end
|