calendarium-romanum 0.4.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/.rubocop.yml +47 -0
- data/.travis.yml +22 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +431 -0
- data/Gemfile +25 -0
- data/Gemfile.lock +86 -0
- data/README.md +598 -0
- data/Rakefile +16 -0
- data/bin/calendariumrom +4 -1
- data/calendarium-romanum.gemspec +31 -0
- data/config/locales/cs.yml +5 -0
- data/config/locales/en.yml +21 -14
- data/config/locales/es.yml +94 -0
- data/config/locales/fr.yml +7 -0
- data/config/locales/it.yml +7 -0
- data/config/locales/la.yml +7 -0
- data/data/README.md +70 -24
- data/data/czech-brno-cs.txt +4 -6
- data/data/czech-budejovice-cs.txt +4 -6
- data/data/czech-cechy-cs.txt +4 -5
- data/data/czech-cs.txt +236 -234
- data/data/czech-hradec-cs.txt +3 -5
- data/data/czech-litomerice-cs.txt +5 -7
- data/data/czech-morava-cs.txt +4 -5
- data/data/czech-olomouc-cs.txt +2 -4
- data/data/czech-ostrava-cs.txt +3 -5
- data/data/czech-plzen-cs.txt +3 -5
- data/data/czech-praha-cs.txt +3 -4
- data/data/easter_dates.txt +67 -0
- data/data/universal-1969-la.txt +234 -0
- data/data/universal-en.txt +214 -211
- data/data/universal-es.txt +243 -0
- data/data/universal-fr.txt +214 -210
- data/data/universal-it.txt +214 -211
- data/data/universal-la.txt +214 -210
- data/doc/data_readme.md +2 -0
- data/doc/images/class_diagram.png +0 -0
- data/doc/images/class_diagram.puml +44 -0
- data/doc/yard_readme.rdoc +76 -0
- data/lib/calendarium-romanum.rb +35 -22
- data/lib/calendarium-romanum/abstract_date.rb +15 -0
- data/lib/calendarium-romanum/calendar.rb +207 -42
- data/lib/calendarium-romanum/cli.rb +63 -80
- data/lib/calendarium-romanum/cli/comparator.rb +63 -0
- data/lib/calendarium-romanum/cli/date_parser.rb +30 -0
- data/lib/calendarium-romanum/cli/dumper.rb +68 -0
- data/lib/calendarium-romanum/cli/helper.rb +23 -0
- data/lib/calendarium-romanum/cli/querier.rb +73 -0
- data/lib/calendarium-romanum/cr.rb +16 -0
- data/lib/calendarium-romanum/data.rb +50 -20
- data/lib/calendarium-romanum/day.rb +208 -32
- data/lib/calendarium-romanum/enum.rb +42 -25
- data/lib/calendarium-romanum/enums.rb +124 -44
- data/lib/calendarium-romanum/errors.rb +4 -0
- data/lib/calendarium-romanum/ordinalizer.rb +23 -2
- data/lib/calendarium-romanum/perpetual_calendar.rb +58 -7
- data/lib/calendarium-romanum/rank.rb +43 -12
- data/lib/calendarium-romanum/rank_predicates.rb +43 -0
- data/lib/calendarium-romanum/sanctorale.rb +164 -24
- data/lib/calendarium-romanum/sanctorale_factory.rb +74 -3
- data/lib/calendarium-romanum/sanctorale_loader.rb +180 -0
- data/lib/calendarium-romanum/sanctorale_writer.rb +119 -0
- data/lib/calendarium-romanum/temporale.rb +226 -94
- data/lib/calendarium-romanum/temporale/celebration_factory.rb +107 -0
- data/lib/calendarium-romanum/temporale/dates.rb +84 -16
- data/lib/calendarium-romanum/temporale/easter_table.rb +27 -0
- data/lib/calendarium-romanum/temporale/extensions.rb +15 -0
- data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +16 -3
- data/lib/calendarium-romanum/temporale/extensions/dedication_before_all_saints.rb +73 -0
- data/lib/calendarium-romanum/transfers.rb +60 -15
- data/lib/calendarium-romanum/util.rb +22 -3
- data/lib/calendarium-romanum/version.rb +5 -1
- data/liturgical_law/1969_normae_universales.md +568 -0
- data/liturgical_law/1977_decretum_de_celebratione_baptismatis_domini.md +58 -0
- data/liturgical_law/1990_decretum_de_variatione_inducenda.md +67 -0
- data/liturgical_law/1998_notificatio_de_occurrentia.md +57 -0
- data/liturgical_law/2002_normae_universales.md +946 -0
- data/liturgical_law/2006_notification.md +37 -0
- data/liturgical_law/2012_declarationes.md +38 -0
- data/liturgical_law/README.md +74 -0
- metadata +50 -28
- data/lib/calendarium-romanum/sanctoraleloader.rb +0 -115
- data/spec/abstract_date_spec.rb +0 -62
- data/spec/calendar_spec.rb +0 -330
- data/spec/celebration_spec.rb +0 -23
- data/spec/cli_spec.rb +0 -26
- data/spec/colour_spec.rb +0 -17
- data/spec/data_spec.rb +0 -23
- data/spec/date_spec.rb +0 -61
- data/spec/dates_spec.rb +0 -45
- data/spec/day_spec.rb +0 -59
- data/spec/enum_spec.rb +0 -51
- data/spec/i18n_spec.rb +0 -59
- data/spec/ordinalizer_spec.rb +0 -22
- data/spec/perpetual_calendar_spec.rb +0 -91
- data/spec/rank_spec.rb +0 -57
- data/spec/readme_spec.rb +0 -52
- data/spec/sanctorale_factory_spec.rb +0 -42
- data/spec/sanctorale_spec.rb +0 -191
- data/spec/sanctoraleloader_spec.rb +0 -171
- data/spec/season_spec.rb +0 -17
- data/spec/spec_helper.rb +0 -35
- data/spec/temporale_spec.rb +0 -519
@@ -0,0 +1,107 @@
|
|
1
|
+
module CalendariumRomanum
|
2
|
+
class Temporale
|
3
|
+
# Provides factory methods building {Celebration}s
|
4
|
+
# for temporale feasts
|
5
|
+
class CelebrationFactory
|
6
|
+
class << self
|
7
|
+
# @yield [Symbol]
|
8
|
+
# @return [void, Enumerator]
|
9
|
+
def each
|
10
|
+
return to_enum(__method__) unless block_given?
|
11
|
+
|
12
|
+
celebrations.each do |symbol|
|
13
|
+
yield public_send(symbol)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [Celebration]
|
18
|
+
def first_advent_sunday
|
19
|
+
Temporale.create_celebration(
|
20
|
+
I18n.t('temporale.advent.sunday', week: Ordinalizer.ordinal(1)),
|
21
|
+
Ranks::PRIMARY,
|
22
|
+
Colours::VIOLET
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def celebrations
|
29
|
+
@celebrations ||= [:first_advent_sunday]
|
30
|
+
end
|
31
|
+
|
32
|
+
def celebration(symbol, rank, colour = Colours::WHITE, fixed_date: nil, sunday: nil)
|
33
|
+
define_singleton_method(symbol) do
|
34
|
+
Temporale.create_celebration(
|
35
|
+
proc { I18n.t("temporale.solemnity.#{symbol}") },
|
36
|
+
rank,
|
37
|
+
colour,
|
38
|
+
symbol: symbol,
|
39
|
+
date: fixed_date,
|
40
|
+
sunday: sunday
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
celebrations << symbol
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Celebration]
|
49
|
+
# @!scope class
|
50
|
+
celebration(:nativity, Ranks::PRIMARY, fixed_date: AbstractDate.new(12, 25))
|
51
|
+
# @return [Celebration]
|
52
|
+
# @!scope class
|
53
|
+
celebration(:holy_family, Ranks::FEAST_LORD_GENERAL)
|
54
|
+
# @return [Celebration]
|
55
|
+
# @!scope class
|
56
|
+
celebration(:mother_of_god, Ranks::SOLEMNITY_GENERAL, fixed_date: AbstractDate.new(1, 1))
|
57
|
+
# @return [Celebration]
|
58
|
+
# @!scope class
|
59
|
+
celebration(:epiphany, Ranks::PRIMARY)
|
60
|
+
# @return [Celebration]
|
61
|
+
# @!scope class
|
62
|
+
celebration(:baptism_of_lord, Ranks::FEAST_LORD_GENERAL)
|
63
|
+
# @return [Celebration]
|
64
|
+
# @!scope class
|
65
|
+
celebration(:ash_wednesday, Ranks::PRIMARY, Colours::VIOLET)
|
66
|
+
# @return [Celebration]
|
67
|
+
# @!scope class
|
68
|
+
celebration(:good_friday, Ranks::TRIDUUM, Colours::RED)
|
69
|
+
# @return [Celebration]
|
70
|
+
# @!scope class
|
71
|
+
celebration(:holy_saturday, Ranks::TRIDUUM, Colours::VIOLET)
|
72
|
+
# @return [Celebration]
|
73
|
+
# @!scope class
|
74
|
+
celebration(:palm_sunday, Ranks::PRIMARY, Colours::RED, sunday: true)
|
75
|
+
# @return [Celebration]
|
76
|
+
# @!scope class
|
77
|
+
celebration(:easter_sunday, Ranks::TRIDUUM)
|
78
|
+
# @return [Celebration]
|
79
|
+
# @!scope class
|
80
|
+
celebration(:ascension, Ranks::PRIMARY)
|
81
|
+
# @return [Celebration]
|
82
|
+
# @!scope class
|
83
|
+
celebration(:pentecost, Ranks::PRIMARY, Colours::RED)
|
84
|
+
# @return [Celebration]
|
85
|
+
# @!scope class
|
86
|
+
celebration(:holy_trinity, Ranks::SOLEMNITY_GENERAL)
|
87
|
+
# @return [Celebration]
|
88
|
+
# @!scope class
|
89
|
+
celebration(:corpus_christi, Ranks::SOLEMNITY_GENERAL)
|
90
|
+
# @return [Celebration]
|
91
|
+
# @!scope class
|
92
|
+
celebration(:sacred_heart, Ranks::SOLEMNITY_GENERAL)
|
93
|
+
# @return [Celebration]
|
94
|
+
# @!scope class
|
95
|
+
celebration(:christ_king, Ranks::SOLEMNITY_GENERAL)
|
96
|
+
# @return [Celebration]
|
97
|
+
# @!scope class
|
98
|
+
celebration(:mother_of_church, Ranks::MEMORIAL_GENERAL)
|
99
|
+
# @return [Celebration]
|
100
|
+
# @!scope class
|
101
|
+
celebration(:immaculate_heart, Ranks::MEMORIAL_GENERAL)
|
102
|
+
# @return [Celebration]
|
103
|
+
# @!scope class
|
104
|
+
celebration(:saturday_memorial_bvm, Ranks::MEMORIAL_OPTIONAL)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -1,15 +1,20 @@
|
|
1
1
|
module CalendariumRomanum
|
2
2
|
class Temporale
|
3
|
-
# dates of movable feasts
|
3
|
+
# Provides methods computing dates of movable feasts
|
4
|
+
# and utilities for common computations of relative dates
|
4
5
|
module Dates
|
6
|
+
# (see .nativity)
|
5
7
|
def self.first_advent_sunday(year)
|
6
8
|
sunday_before(nativity(year)) - 3 * WEEK
|
7
9
|
end
|
8
10
|
|
11
|
+
# @param year [Integer] liturgical year
|
12
|
+
# @return [Date]
|
9
13
|
def self.nativity(year)
|
10
14
|
Date.new(year, 12, 25)
|
11
15
|
end
|
12
16
|
|
17
|
+
# (see .nativity)
|
13
18
|
def self.holy_family(year)
|
14
19
|
xmas = nativity(year)
|
15
20
|
if xmas.sunday?
|
@@ -19,32 +24,41 @@ module CalendariumRomanum
|
|
19
24
|
end
|
20
25
|
end
|
21
26
|
|
27
|
+
# (see .nativity)
|
22
28
|
def self.mother_of_god(year)
|
23
29
|
octave_of(nativity(year))
|
24
30
|
end
|
25
31
|
|
32
|
+
# @param year [Integer] liturgical year
|
33
|
+
# @param sunday [Boolean] transfer to Sunday?
|
34
|
+
# @return [Date]
|
26
35
|
def self.epiphany(year, sunday: false)
|
27
36
|
if sunday
|
28
37
|
# GNLYC 7 a)
|
29
38
|
return sunday_after(Date.new(year + 1, 1, 1))
|
30
39
|
end
|
31
40
|
|
32
|
-
Date.new(year+1, 1, 6)
|
41
|
+
Date.new(year + 1, 1, 6)
|
33
42
|
end
|
34
43
|
|
44
|
+
# @param year [Integer] liturgical year
|
45
|
+
# @param epiphany_on_sunday [Boolean] was Epiphany transferred to Sunday?
|
46
|
+
# @return [Date]
|
35
47
|
def self.baptism_of_lord(year, epiphany_on_sunday: false)
|
36
48
|
e = epiphany(year, sunday: epiphany_on_sunday)
|
37
|
-
if
|
49
|
+
if e.day > 6
|
38
50
|
e + 1
|
39
51
|
else
|
40
52
|
sunday_after e
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
56
|
+
# (see .nativity)
|
44
57
|
def self.ash_wednesday(year)
|
45
58
|
easter_sunday(year) - (6 * WEEK + 4)
|
46
59
|
end
|
47
60
|
|
61
|
+
# (see .nativity)
|
48
62
|
def self.easter_sunday(year)
|
49
63
|
year += 1
|
50
64
|
|
@@ -58,31 +72,35 @@ module CalendariumRomanum
|
|
58
72
|
paschal_full_moon = (3 - 11 * golden_number + solar_correction - lunar_correction) % 30
|
59
73
|
dominical_number += 7 until dominical_number > 0
|
60
74
|
paschal_full_moon += 30 until paschal_full_moon > 0
|
61
|
-
paschal_full_moon -= 1 if paschal_full_moon == 29
|
75
|
+
paschal_full_moon -= 1 if (paschal_full_moon == 29) || ((paschal_full_moon == 28) && golden_number > 11)
|
62
76
|
difference = (4 - paschal_full_moon - dominical_number) % 7
|
63
77
|
difference += 7 if difference < 0
|
64
78
|
day_easter = paschal_full_moon + difference + 1
|
65
|
-
if day_easter < 11
|
79
|
+
if day_easter < 11
|
66
80
|
# Easter occurs in March.
|
67
|
-
return Date.new(
|
81
|
+
return Date.new(year, 3, day_easter + 21)
|
68
82
|
else
|
69
83
|
# Easter occurs in April.
|
70
|
-
return Date.new(
|
84
|
+
return Date.new(year, 4, day_easter - 10)
|
71
85
|
end
|
72
86
|
end
|
73
87
|
|
88
|
+
# (see .nativity)
|
74
89
|
def self.palm_sunday(year)
|
75
90
|
easter_sunday(year) - 7
|
76
91
|
end
|
77
92
|
|
93
|
+
# (see .nativity)
|
78
94
|
def self.good_friday(year)
|
79
95
|
easter_sunday(year) - 2
|
80
96
|
end
|
81
97
|
|
98
|
+
# (see .nativity)
|
82
99
|
def self.holy_saturday(year)
|
83
100
|
easter_sunday(year) - 1
|
84
101
|
end
|
85
102
|
|
103
|
+
# (see .epiphany)
|
86
104
|
def self.ascension(year, sunday: false)
|
87
105
|
if sunday
|
88
106
|
# GNLYC 7 b)
|
@@ -92,14 +110,17 @@ module CalendariumRomanum
|
|
92
110
|
pentecost(year) - 10
|
93
111
|
end
|
94
112
|
|
113
|
+
# (see .nativity)
|
95
114
|
def self.pentecost(year)
|
96
115
|
easter_sunday(year) + 7 * WEEK
|
97
116
|
end
|
98
117
|
|
118
|
+
# (see .nativity)
|
99
119
|
def self.holy_trinity(year)
|
100
120
|
octave_of(pentecost(year))
|
101
121
|
end
|
102
122
|
|
123
|
+
# (see .epiphany)
|
103
124
|
def self.corpus_christi(year, sunday: false)
|
104
125
|
if sunday
|
105
126
|
# GNLYC 7 c)
|
@@ -109,46 +130,93 @@ module CalendariumRomanum
|
|
109
130
|
holy_trinity(year) + 4
|
110
131
|
end
|
111
132
|
|
133
|
+
# (see .nativity)
|
112
134
|
def self.sacred_heart(year)
|
113
135
|
corpus_christi(year) + 8
|
114
136
|
end
|
115
137
|
|
138
|
+
# (see .nativity)
|
139
|
+
def self.mother_of_church(year)
|
140
|
+
pentecost(year) + 1
|
141
|
+
end
|
142
|
+
|
143
|
+
# (see .nativity)
|
116
144
|
def self.immaculate_heart(year)
|
117
145
|
pentecost(year) + 20
|
118
146
|
end
|
119
147
|
|
148
|
+
# (see .nativity)
|
120
149
|
def self.christ_king(year)
|
121
150
|
first_advent_sunday(year + 1) - 7
|
122
151
|
end
|
123
152
|
|
124
153
|
# utility methods
|
125
154
|
|
155
|
+
# @param weekday [Integer]
|
156
|
+
# @param date [Date]
|
157
|
+
# @return [Date]
|
126
158
|
def self.weekday_before(weekday, date)
|
127
|
-
if date.wday == weekday
|
128
|
-
|
159
|
+
if date.wday == weekday
|
160
|
+
date - WEEK
|
129
161
|
elsif weekday < date.wday
|
130
|
-
|
162
|
+
date - (date.wday - weekday)
|
131
163
|
else
|
132
|
-
|
164
|
+
date - (date.wday + WEEK - weekday)
|
133
165
|
end
|
134
166
|
end
|
135
167
|
|
168
|
+
# (see .weekday_before)
|
136
169
|
def self.weekday_after(weekday, date)
|
137
|
-
if date.wday == weekday
|
138
|
-
|
170
|
+
if date.wday == weekday
|
171
|
+
date + WEEK
|
139
172
|
elsif weekday > date.wday
|
140
|
-
|
173
|
+
date + (weekday - date.wday)
|
141
174
|
else
|
142
|
-
|
175
|
+
date + (WEEK - date.wday + weekday)
|
143
176
|
end
|
144
177
|
end
|
145
178
|
|
179
|
+
# @param date [Date]
|
180
|
+
# @return [Date]
|
146
181
|
def self.octave_of(date)
|
147
182
|
date + WEEK
|
148
183
|
end
|
149
184
|
|
150
185
|
class << self
|
151
|
-
|
186
|
+
# @!method sunday_before(date)
|
187
|
+
# @param date [Date]
|
188
|
+
# @return [Date]
|
189
|
+
# @!method monday_before(date)
|
190
|
+
# (see .sunday_before)
|
191
|
+
# @!method tuesday_before(date)
|
192
|
+
# (see .sunday_before)
|
193
|
+
# @!method wednesday_before(date)
|
194
|
+
# (see .sunday_before)
|
195
|
+
# @!method thursday_before(date)
|
196
|
+
# (see .sunday_before)
|
197
|
+
# @!method friday_before(date)
|
198
|
+
# (see .sunday_before)
|
199
|
+
# @!method saturday_before(date)
|
200
|
+
# (see .sunday_before)
|
201
|
+
|
202
|
+
# @!method sunday_after(date)
|
203
|
+
# @param date [Date]
|
204
|
+
# @return [Date]
|
205
|
+
# @!method monday_after(date)
|
206
|
+
# (see .sunday_after)
|
207
|
+
# @!method tuesday_after(date)
|
208
|
+
# (see .sunday_after)
|
209
|
+
# @!method wednesday_after(date)
|
210
|
+
# (see .sunday_after)
|
211
|
+
# @!method thursday_after(date)
|
212
|
+
# (see .sunday_after)
|
213
|
+
# @!method friday_after(date)
|
214
|
+
# (see .sunday_after)
|
215
|
+
# @!method saturday_after(date)
|
216
|
+
# (see .sunday_after)
|
217
|
+
|
218
|
+
# @api private
|
219
|
+
WEEKDAYS = %w(sunday monday tuesday wednesday thursday friday saturday).freeze
|
152
220
|
WEEKDAYS.each_with_index do |weekday, weekday_i|
|
153
221
|
define_method "#{weekday}_before" do |date|
|
154
222
|
send('weekday_before', weekday_i, date)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module CalendariumRomanum
|
2
|
+
class Temporale
|
3
|
+
# @since 0.8.0
|
4
|
+
class EasterTable
|
5
|
+
# Loads an Easter table from a String- or IO-like object +src+.
|
6
|
+
# +src+ must contain Easter dates, parseable by +Date.parse+, one date per line.
|
7
|
+
# Blank lines and bash-like comments are ignored.
|
8
|
+
# Returns a +Hash+ mapping (liturgical) year to Easter date.
|
9
|
+
#
|
10
|
+
# @param src [#each_line]
|
11
|
+
# @return [Hash<Integer=>Date>]
|
12
|
+
def self.load_from(src)
|
13
|
+
r = {}
|
14
|
+
src.each_line do |l|
|
15
|
+
cleaned = l.sub(/#.*$/, '').strip
|
16
|
+
next if cleaned == ''
|
17
|
+
|
18
|
+
date = Date.parse cleaned
|
19
|
+
liturgical_year = date.year - 1
|
20
|
+
r[liturgical_year] = date
|
21
|
+
end
|
22
|
+
|
23
|
+
r
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CalendariumRomanum
|
2
|
+
class Temporale
|
3
|
+
module Extensions
|
4
|
+
# Returns all Temporale extensions defined by the gem.
|
5
|
+
#
|
6
|
+
# @return [Array<Module>]
|
7
|
+
# @since 0.8.0
|
8
|
+
def self.all
|
9
|
+
constants
|
10
|
+
.collect {|c| const_get(c) }
|
11
|
+
.select {|c| c.is_a? Module }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,21 +1,34 @@
|
|
1
1
|
module CalendariumRomanum
|
2
2
|
class Temporale
|
3
3
|
module Extensions
|
4
|
-
# Temporale extension adding
|
4
|
+
# {Temporale} extension adding the movable feast
|
5
|
+
# of "Christ Eternal Priests",
|
5
6
|
# included in some local calendars
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# temporale = Temporale.new(2015, extensions: [
|
10
|
+
# Temporale::Extensions::ChristEternalPriest
|
11
|
+
# ])
|
6
12
|
module ChristEternalPriest
|
13
|
+
# @yield [Symbol, Celebration]
|
14
|
+
# @return [void]
|
7
15
|
def self.each_celebration
|
8
16
|
yield(
|
17
|
+
# symbol refers to the date-computing method
|
9
18
|
:christ_eternal_priest,
|
10
19
|
Celebration.new(
|
11
20
|
proc { I18n.t('temporale.extension.christ_eternal_priest') },
|
12
21
|
Ranks::FEAST_PROPER,
|
13
|
-
Colours::WHITE
|
22
|
+
Colours::WHITE,
|
23
|
+
:christ_eternal_priest
|
14
24
|
)
|
15
25
|
)
|
16
26
|
end
|
17
27
|
|
18
|
-
#
|
28
|
+
# Computes the feast's date
|
29
|
+
#
|
30
|
+
# @param year [Integer] liturgical year
|
31
|
+
# @return [Date]
|
19
32
|
def self.christ_eternal_priest(year)
|
20
33
|
Dates.pentecost(year) + 4
|
21
34
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module CalendariumRomanum
|
2
|
+
class Temporale
|
3
|
+
module Extensions
|
4
|
+
# {Temporale} extension adding solemnity of dedication
|
5
|
+
# of a church celebrated on the Sunday before All Saints /
|
6
|
+
# last October Sunday.
|
7
|
+
#
|
8
|
+
# In churches, whose actual day of consecration is unknown, the anniversary
|
9
|
+
# of consecration is celebrated either on October 25th, or on the Sunday
|
10
|
+
# before All Saints (cf. Notitiae 71/1972, p. 103).
|
11
|
+
# This extension implements the latter case.
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# # It can be used either this way
|
15
|
+
# temporale = Temporale.new(2015, extensions: [
|
16
|
+
# Temporale::Extensions::DedicationBeforeAllSaints
|
17
|
+
# ])
|
18
|
+
#
|
19
|
+
# # Or, if you want to customize celebration title and/or symbol:
|
20
|
+
# temporale = Temporale.new(2015, extensions: [
|
21
|
+
# Temporale::Extensions::DedicationBeforeAllSaints.new(title: 'Title', symbol: :symbol)
|
22
|
+
# ])
|
23
|
+
#
|
24
|
+
# @since 0.8.0
|
25
|
+
class DedicationBeforeAllSaints
|
26
|
+
DEFAULT_TITLE = proc { I18n.t('temporale.extension.dedication') }
|
27
|
+
DEFAULT_SYMBOL = :dedication
|
28
|
+
|
29
|
+
# @yield [Symbol, Celebration]
|
30
|
+
# @return [void]
|
31
|
+
def self.each_celebration
|
32
|
+
yield(
|
33
|
+
# symbol refers to the date-computing method
|
34
|
+
:dedication,
|
35
|
+
Celebration.new(
|
36
|
+
DEFAULT_TITLE,
|
37
|
+
Ranks::SOLEMNITY_PROPER,
|
38
|
+
Colours::WHITE,
|
39
|
+
DEFAULT_SYMBOL
|
40
|
+
)
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Computes date of the solemnity
|
45
|
+
#
|
46
|
+
# @param year [Integer] liturgical year
|
47
|
+
# @return [Date]
|
48
|
+
def self.dedication(year)
|
49
|
+
Dates.sunday_before(Date.new(year + 1, 11, 1))
|
50
|
+
end
|
51
|
+
|
52
|
+
def initialize(title: DEFAULT_TITLE, symbol: DEFAULT_SYMBOL)
|
53
|
+
@title = title
|
54
|
+
@symbol = symbol
|
55
|
+
end
|
56
|
+
|
57
|
+
# @yield [Symbol, Celebration]
|
58
|
+
# @return [void]
|
59
|
+
def each_celebration
|
60
|
+
yield(
|
61
|
+
proc {|year| self.class.dedication(year) },
|
62
|
+
Celebration.new(
|
63
|
+
@title,
|
64
|
+
Ranks::SOLEMNITY_PROPER,
|
65
|
+
Colours::WHITE,
|
66
|
+
@symbol
|
67
|
+
)
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|