calendarium-romanum 0.2.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/calendariumrom +4 -1
- data/config/locales/cs.yml +54 -2
- data/config/locales/en.yml +64 -14
- data/config/locales/es.yml +90 -0
- data/config/locales/fr.yml +90 -0
- data/config/locales/it.yml +54 -4
- data/config/locales/la.yml +52 -2
- data/data/README.md +105 -5
- data/data/czech-brno-cs.txt +11 -5
- data/data/czech-budejovice-cs.txt +11 -5
- data/data/czech-cechy-cs.txt +11 -5
- data/data/czech-cs.txt +243 -234
- data/data/czech-hradec-cs.txt +10 -4
- data/data/czech-litomerice-cs.txt +12 -6
- data/data/czech-morava-cs.txt +11 -5
- data/data/czech-olomouc-cs.txt +9 -3
- data/data/czech-ostrava-cs.txt +10 -4
- data/data/czech-plzen-cs.txt +10 -4
- data/data/czech-praha-cs.txt +10 -3
- data/data/universal-en.txt +218 -212
- data/data/universal-es.txt +243 -0
- data/data/universal-fr.txt +243 -0
- data/data/universal-it.txt +218 -212
- data/data/universal-la.txt +218 -211
- data/lib/calendarium-romanum.rb +30 -18
- data/lib/calendarium-romanum/abstract_date.rb +12 -0
- data/lib/calendarium-romanum/calendar.rb +210 -48
- data/lib/calendarium-romanum/cli.rb +101 -52
- data/lib/calendarium-romanum/cr.rb +16 -0
- data/lib/calendarium-romanum/data.rb +46 -18
- data/lib/calendarium-romanum/day.rb +200 -21
- data/lib/calendarium-romanum/enum.rb +24 -5
- data/lib/calendarium-romanum/enums.rb +123 -37
- data/lib/calendarium-romanum/errors.rb +4 -0
- data/lib/calendarium-romanum/ordinalizer.rb +61 -0
- data/lib/calendarium-romanum/perpetual_calendar.rb +97 -0
- data/lib/calendarium-romanum/rank.rb +43 -6
- data/lib/calendarium-romanum/sanctorale.rb +142 -22
- data/lib/calendarium-romanum/sanctorale_factory.rb +74 -3
- data/lib/calendarium-romanum/sanctorale_loader.rb +176 -0
- data/lib/calendarium-romanum/temporale.rb +296 -251
- data/lib/calendarium-romanum/temporale/celebration_factory.rb +106 -0
- data/lib/calendarium-romanum/temporale/dates.rb +232 -0
- data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +37 -0
- data/lib/calendarium-romanum/transfers.rb +43 -6
- data/lib/calendarium-romanum/util.rb +36 -3
- data/lib/calendarium-romanum/version.rb +5 -1
- data/spec/abstract_date_spec.rb +11 -3
- data/spec/calendar_spec.rb +645 -188
- data/spec/celebration_factory_spec.rb +40 -0
- data/spec/celebration_spec.rb +67 -0
- data/spec/cli_spec.rb +154 -11
- data/spec/colour_spec.rb +22 -0
- data/spec/data_spec.rb +26 -3
- data/spec/date_parser_spec.rb +68 -0
- data/spec/date_spec.rb +8 -8
- data/spec/dates_spec.rb +73 -0
- data/spec/day_spec.rb +151 -0
- data/spec/i18n_spec.rb +11 -2
- data/spec/ordinalizer_spec.rb +44 -0
- data/spec/perpetual_calendar_spec.rb +125 -0
- data/spec/rank_spec.rb +42 -7
- data/spec/readme_spec.rb +18 -10
- data/spec/sanctorale_factory_spec.rb +113 -9
- data/spec/sanctorale_loader_spec.rb +229 -0
- data/spec/sanctorale_spec.rb +176 -62
- data/spec/season_spec.rb +22 -0
- data/spec/spec_helper.rb +27 -1
- data/spec/temporale_spec.rb +473 -154
- data/spec/year_spec.rb +25 -0
- metadata +42 -7
- data/lib/calendarium-romanum/sanctoraleloader.rb +0 -104
- data/spec/sanctoraleloader_spec.rb +0 -171
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'calendarium-romanum'
|
2
|
+
|
3
|
+
# The module name {CalendariumRomanum} is quite long,
|
4
|
+
# hence constant +CR+ is provided as a convenient shortcut.
|
5
|
+
# It is _not_ loaded by +require 'calendarium-romanum'+,
|
6
|
+
# must be required explicitly +require 'calendarium-romanum/cr'+ -
|
7
|
+
# because there's a good chance
|
8
|
+
# that the short constant name clashes with a constant
|
9
|
+
# defined by some other code.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# require 'calendarium-romanum/cr'
|
13
|
+
#
|
14
|
+
# calendar = CR::Calendar.new 2000
|
15
|
+
# @since 0.7.0
|
16
|
+
CR = CalendariumRomanum
|
@@ -1,8 +1,16 @@
|
|
1
1
|
module CalendariumRomanum
|
2
|
-
#
|
2
|
+
# Allows easy access to bundled data files
|
3
|
+
#
|
4
|
+
# @example
|
5
|
+
# sanctorale = CalendariumRomanum::Data::GENERAL_ROMAN_LATIN.load
|
3
6
|
class Data < Enum
|
4
7
|
|
5
8
|
class SanctoraleFile
|
9
|
+
# This class is not intended to be initialized by client code -
|
10
|
+
# it's sole purpose is to provide functionality for easy
|
11
|
+
# loading of the bundled sanctorale data files.
|
12
|
+
#
|
13
|
+
# @api private
|
6
14
|
def initialize(base_name)
|
7
15
|
@siglum = base_name.sub(/\.txt$/, '')
|
8
16
|
@path = File.expand_path('../../data/' + base_name, File.dirname(__FILE__))
|
@@ -10,32 +18,52 @@ module CalendariumRomanum
|
|
10
18
|
|
11
19
|
attr_reader :siglum, :path
|
12
20
|
|
21
|
+
# Load the data file
|
22
|
+
#
|
23
|
+
# @return [Sanctorale]
|
13
24
|
def load
|
14
|
-
SanctoraleLoader.new.load_from_file(
|
25
|
+
SanctoraleLoader.new.load_from_file(path)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Load the data file and all it's parents
|
29
|
+
#
|
30
|
+
# @return [Sanctorale]
|
31
|
+
# @since 0.7.0
|
32
|
+
def load_with_parents
|
33
|
+
SanctoraleFactory.load_with_parents(path)
|
15
34
|
end
|
16
35
|
end
|
17
36
|
|
37
|
+
GENERAL_ROMAN_LATIN = SanctoraleFile.new('universal-la.txt')
|
38
|
+
GENERAL_ROMAN_ENGLISH = SanctoraleFile.new('universal-en.txt')
|
39
|
+
GENERAL_ROMAN_FRENCH = SanctoraleFile.new('universal-fr.txt')
|
40
|
+
GENERAL_ROMAN_ITALIAN = SanctoraleFile.new('universal-it.txt')
|
41
|
+
GENERAL_ROMAN_SPANISH = SanctoraleFile.new('universal-es.txt')
|
42
|
+
CZECH = SanctoraleFile.new('czech-cs.txt')
|
43
|
+
|
18
44
|
values(index_by: :siglum) do
|
19
45
|
# only calendars of broader interest have constants defined
|
20
46
|
[
|
21
|
-
GENERAL_ROMAN_LATIN
|
22
|
-
GENERAL_ROMAN_ENGLISH
|
23
|
-
|
24
|
-
|
47
|
+
GENERAL_ROMAN_LATIN,
|
48
|
+
GENERAL_ROMAN_ENGLISH,
|
49
|
+
GENERAL_ROMAN_FRENCH,
|
50
|
+
GENERAL_ROMAN_ITALIAN,
|
51
|
+
GENERAL_ROMAN_SPANISH,
|
52
|
+
CZECH,
|
25
53
|
] \
|
26
54
|
+
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
55
|
+
%w(
|
56
|
+
czech-brno-cs.txt
|
57
|
+
czech-budejovice-cs.txt
|
58
|
+
czech-cechy-cs.txt
|
59
|
+
czech-hradec-cs.txt
|
60
|
+
czech-litomerice-cs.txt
|
61
|
+
czech-morava-cs.txt
|
62
|
+
czech-olomouc-cs.txt
|
63
|
+
czech-ostrava-cs.txt
|
64
|
+
czech-plzen-cs.txt
|
65
|
+
czech-praha-cs.txt
|
66
|
+
).collect {|basename| SanctoraleFile.new(basename) }
|
39
67
|
end
|
40
68
|
end
|
41
69
|
end
|
@@ -2,55 +2,156 @@ require 'forwardable'
|
|
2
2
|
|
3
3
|
module CalendariumRomanum
|
4
4
|
|
5
|
-
#
|
5
|
+
# Information on one particular day of the liturgical year
|
6
6
|
class Day
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
# Note: despite of all constructor arguments being nullable,
|
8
|
+
# instances returned by {Calendar} always have all of them set,
|
9
|
+
# the only exception being +vespers+.
|
10
|
+
#
|
11
|
+
# @param date [Date, nil]
|
12
|
+
# @param season [Season, nil]
|
13
|
+
# @param season_week [Fixnum, nil]
|
14
|
+
# @param celebrations [Array<Celebration>, nil]
|
15
|
+
# @param vespers [Celebration, nil]
|
16
|
+
def initialize(date: nil, season: nil, season_week: nil, celebrations: nil, vespers: nil)
|
17
|
+
@date = date
|
18
|
+
@season = season
|
19
|
+
@season_week = season_week
|
20
|
+
@celebrations = celebrations ? celebrations.dup : []
|
21
|
+
@vespers = vespers
|
17
22
|
end
|
18
23
|
|
24
|
+
# @return [Date]
|
19
25
|
attr_reader :date
|
20
26
|
|
27
|
+
# Weekday as integer (Sunday is 0)
|
28
|
+
#
|
29
|
+
# @return [Fixnum]
|
21
30
|
def weekday
|
22
31
|
date.wday
|
23
32
|
end
|
24
33
|
|
25
|
-
#
|
34
|
+
# Weekday as internationalized string
|
35
|
+
#
|
36
|
+
# @return [String]
|
37
|
+
# @since 0.7.0
|
38
|
+
def weekday_name
|
39
|
+
I18n.t(date.wday, scope: 'weekday')
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [Season]
|
26
43
|
attr_reader :season
|
27
44
|
|
28
|
-
#
|
45
|
+
# Week of the season
|
46
|
+
#
|
47
|
+
# @return [Fixnum]
|
29
48
|
attr_reader :season_week
|
30
49
|
|
31
|
-
#
|
50
|
+
# List of celebrations for the given day.
|
51
|
+
#
|
52
|
+
# In tests and other "less-standard" situations the array
|
53
|
+
# may be empty, but it's never empty for instances
|
54
|
+
# returned by {Calendar}.
|
55
|
+
#
|
56
|
+
# @return [Array<Celebration>]
|
32
57
|
attr_reader :celebrations
|
33
58
|
|
34
|
-
# Celebration
|
59
|
+
# {Celebration} whose first Vespers are celebrated
|
60
|
+
# in place of Vespers of the day's {Celebration}(s).
|
61
|
+
# Please note that {Calendar} by default _doesn't_ populate
|
62
|
+
# Vespers, - it's an opt-in feature
|
63
|
+
# (see {Calendar#initialize}, {Calendar#populates_vespers?},
|
64
|
+
# {Calendar#day}).
|
65
|
+
#
|
66
|
+
# @return [Celebration, nil]
|
67
|
+
# @since 0.5.0
|
35
68
|
attr_reader :vespers
|
69
|
+
|
70
|
+
def ==(other)
|
71
|
+
self.class == other.class &&
|
72
|
+
date == other.date &&
|
73
|
+
season == other.season &&
|
74
|
+
season_week == other.season_week &&
|
75
|
+
celebrations == other.celebrations &&
|
76
|
+
vespers == other.vespers
|
77
|
+
end
|
78
|
+
|
79
|
+
# Are the day's Vespers suppressed in favour of first Vespers
|
80
|
+
# of a Sunday or solemnity?
|
81
|
+
#
|
82
|
+
# @return [Boolean]
|
83
|
+
def vespers_from_following?
|
84
|
+
!vespers.nil?
|
85
|
+
end
|
86
|
+
|
87
|
+
# String representation of the instance listing it's contents.
|
88
|
+
# Intended mostly for debugging purposes.
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
# @since 0.7.0
|
92
|
+
def to_s
|
93
|
+
celebrations_string = '['
|
94
|
+
celebrations.each do |c|
|
95
|
+
celebrations_string << c.to_s + ', '
|
96
|
+
end
|
97
|
+
celebrations_string = celebrations_string.chomp(', ') << ']'
|
98
|
+
"#<#{self.class.name} @date=#{date} @season=#{season} @season_week=#{season_week} celebrations=#{celebrations_string} vespers=#{vespers.inspect}>"
|
99
|
+
end
|
36
100
|
end
|
37
101
|
|
38
|
-
#
|
102
|
+
# One particular celebration of the liturgical year
|
39
103
|
# (like a Sunday, feast or memorial);
|
40
|
-
# some days have
|
41
|
-
# some have more among which one
|
104
|
+
# some days have one,
|
105
|
+
# some have more among which one is to be chosen
|
42
106
|
class Celebration
|
43
107
|
extend Forwardable
|
44
108
|
|
45
|
-
|
109
|
+
# @param title [String|Proc]
|
110
|
+
# Celebration title/name.
|
111
|
+
# If a +Proc+ is passed, it is expected not to receive
|
112
|
+
# arguments and to return a +String+.
|
113
|
+
# (Used for celebration titles which have to be
|
114
|
+
# internationalizable - the +Proc+ is called whenever
|
115
|
+
# {#title} is invoked, which allows the value to vary
|
116
|
+
# depending e.g. on state of the +Proc+ or some
|
117
|
+
# global setting - like +I18n.locale+ - it may access.)
|
118
|
+
# @param rank [Rank] Celebration rank
|
119
|
+
# @param colour [Colour] Liturgical colour
|
120
|
+
# @param symbol [Symbol, nil]
|
121
|
+
# Unique machine-readable identifier of the celebration
|
122
|
+
# @param date [AbstractDate, nil]
|
123
|
+
# Normal fixed date of the celebration
|
124
|
+
# @param cycle [:sanctorale, :temporale]
|
125
|
+
# Cycle the celebration belongs to
|
126
|
+
def initialize(title = '', rank = Ranks::FERIAL, colour = Colours::GREEN, symbol = nil, date = nil, cycle = :sanctorale)
|
46
127
|
@title = title
|
47
128
|
@rank = rank
|
48
129
|
@colour = colour
|
130
|
+
@symbol = symbol
|
131
|
+
@date = date
|
132
|
+
@cycle = cycle
|
49
133
|
end
|
50
134
|
|
135
|
+
# @return [Rank]
|
51
136
|
attr_reader :rank
|
52
|
-
def_delegators :@rank, :solemnity?, :feast?, :memorial?
|
53
137
|
|
138
|
+
# @!method solemnity?
|
139
|
+
# @return [Boolean]
|
140
|
+
# @!method feast?
|
141
|
+
# @return [Boolean]
|
142
|
+
# @!method memorial?
|
143
|
+
# @return [Boolean]
|
144
|
+
# @!method sunday?
|
145
|
+
# @return [Boolean]
|
146
|
+
# @since 0.6.0
|
147
|
+
# @!method ferial?
|
148
|
+
# @return [Boolean]
|
149
|
+
# @since 0.6.0
|
150
|
+
def_delegators :@rank, :solemnity?, :feast?, :memorial?, :sunday?, :ferial?
|
151
|
+
|
152
|
+
# Feast title/name
|
153
|
+
#
|
154
|
+
# @return [String]
|
54
155
|
def title
|
55
156
|
if @title.respond_to? :call
|
56
157
|
@title.call
|
@@ -59,7 +160,85 @@ module CalendariumRomanum
|
|
59
160
|
end
|
60
161
|
end
|
61
162
|
|
163
|
+
# Liturgical colour
|
164
|
+
#
|
165
|
+
# @return [Colour]
|
62
166
|
attr_reader :colour
|
63
|
-
|
167
|
+
alias color colour
|
168
|
+
|
169
|
+
# Symbol uniquely identifying the celebration
|
170
|
+
#
|
171
|
+
# @return [Symbol, nil]
|
172
|
+
# @since 0.5.0
|
173
|
+
attr_reader :symbol
|
174
|
+
|
175
|
+
# Usual date of the celebration.
|
176
|
+
#
|
177
|
+
# Only set for celebrations with fixed date.
|
178
|
+
# (Only) In case of solemnities it may happen that
|
179
|
+
# {Celebration#date} differs from {Day#date} due to
|
180
|
+
# transfer of an impeded solemnity.
|
181
|
+
#
|
182
|
+
# @return [AbstractDate, nil]
|
183
|
+
# @since 0.6.0
|
184
|
+
attr_reader :date
|
185
|
+
|
186
|
+
# Describes the celebration as belonging either to the
|
187
|
+
# temporale or sanctorale cycle
|
188
|
+
#
|
189
|
+
# @return [:sanctorale, :temporale]
|
190
|
+
# @since 0.6.0
|
191
|
+
attr_reader :cycle
|
192
|
+
|
193
|
+
def ==(b)
|
194
|
+
self.class == b.class &&
|
195
|
+
title == b.title &&
|
196
|
+
rank == b.rank &&
|
197
|
+
colour == b.colour &&
|
198
|
+
symbol == b.symbol &&
|
199
|
+
date == b.date &&
|
200
|
+
cycle == b.cycle
|
201
|
+
end
|
202
|
+
|
203
|
+
# Does the celebration belong to the temporale cycle?
|
204
|
+
#
|
205
|
+
# @return [Boolean]
|
206
|
+
# @since 0.6.0
|
207
|
+
def temporale?
|
208
|
+
cycle == :temporale
|
209
|
+
end
|
210
|
+
|
211
|
+
# Does the celebration belong to the sanctorale cycle?
|
212
|
+
#
|
213
|
+
# @return [Boolean]
|
214
|
+
# @since 0.6.0
|
215
|
+
def sanctorale?
|
216
|
+
cycle == :sanctorale
|
217
|
+
end
|
218
|
+
|
219
|
+
# Build a new instance using the receiver's attributes
|
220
|
+
# for all properties for which (a non-nil) value was not passed.
|
221
|
+
#
|
222
|
+
# @return [Celebration]
|
223
|
+
# @since 0.5.0
|
224
|
+
def change(title: nil, rank: nil, colour: nil, color: nil, symbol: nil, date: nil, cycle: nil)
|
225
|
+
self.class.new(
|
226
|
+
title || self.title,
|
227
|
+
rank || self.rank,
|
228
|
+
colour || color || self.colour,
|
229
|
+
symbol || self.symbol,
|
230
|
+
date || self.date,
|
231
|
+
cycle || self.cycle,
|
232
|
+
)
|
233
|
+
end
|
234
|
+
|
235
|
+
# String representation of the object's contents
|
236
|
+
# (not very pretty, intended mostly for development inspections).
|
237
|
+
#
|
238
|
+
# @return [String]
|
239
|
+
# @since 0.7.0
|
240
|
+
def to_s
|
241
|
+
"#<#{self.class.name} @title=\"#{title}\" @rank=#{rank} @colour=#{colour} symbol=#{symbol.inspect} date=#{date.inspect} cycle=#{cycle.inspect}>"
|
242
|
+
end
|
64
243
|
end
|
65
244
|
end
|
@@ -1,12 +1,18 @@
|
|
1
1
|
require 'forwardable'
|
2
2
|
|
3
3
|
module CalendariumRomanum
|
4
|
-
#
|
4
|
+
# Each subclass encapsulates a finite set of value objects.
|
5
|
+
#
|
6
|
+
# @abstract
|
5
7
|
class Enum
|
6
8
|
class << self
|
7
9
|
extend Forwardable
|
8
10
|
|
9
|
-
|
11
|
+
# @api private
|
12
|
+
# @param index_by
|
13
|
+
# specifies which value objects' property contains
|
14
|
+
# unique internal identifier for use with {.[]}
|
15
|
+
def values(index_by: nil)
|
10
16
|
defined?(@indexed) && raise(RuntimeError.new('initialized repeatedly'))
|
11
17
|
|
12
18
|
@indexed = {}
|
@@ -22,11 +28,24 @@ module CalendariumRomanum
|
|
22
28
|
@indexed.freeze
|
23
29
|
end
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
31
|
+
# Returns all contained value objects
|
32
|
+
#
|
33
|
+
# @return [Array]
|
34
|
+
attr_reader :all
|
28
35
|
|
36
|
+
# Enumerates contained value objects
|
37
|
+
#
|
38
|
+
# @!method each
|
39
|
+
# @yield value object
|
40
|
+
# @return [void]
|
29
41
|
def_delegators :@all, :each
|
42
|
+
|
43
|
+
# Allows accessing contained value objects by their
|
44
|
+
# internal unique identifiers
|
45
|
+
#
|
46
|
+
# @!method [](identifier)
|
47
|
+
# @param identifier
|
48
|
+
# @return value object or nil
|
30
49
|
def_delegators :@indexed, :[]
|
31
50
|
end
|
32
51
|
end
|
@@ -1,57 +1,143 @@
|
|
1
1
|
module CalendariumRomanum
|
2
|
+
# Methods shared by most value objects defined by the gem
|
3
|
+
module ValueObjectInterface
|
4
|
+
# Machine-readable internal representation of the value
|
5
|
+
#
|
6
|
+
# @return [Symbol]
|
7
|
+
attr_reader :symbol
|
8
|
+
alias to_sym symbol
|
2
9
|
|
10
|
+
# Internationalized, human-readable name
|
11
|
+
#
|
12
|
+
# @return [String]
|
13
|
+
def name
|
14
|
+
I18n.t @i18n_key
|
15
|
+
end
|
16
|
+
|
17
|
+
# String representation of the contents for debugging purposes
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
def to_s
|
21
|
+
"#<#{self.class.name} #{symbol}>"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Represents a liturgical colour
|
26
|
+
class Colour
|
27
|
+
include ValueObjectInterface
|
28
|
+
|
29
|
+
def initialize(symbol)
|
30
|
+
@symbol = symbol
|
31
|
+
@i18n_key = "colour.#{@symbol}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Standard set of liturgical colours
|
36
|
+
class Colours < Enum
|
37
|
+
GREEN = Colour.new(:green)
|
38
|
+
VIOLET = Colour.new(:violet)
|
39
|
+
WHITE = Colour.new(:white)
|
40
|
+
RED = Colour.new(:red)
|
41
|
+
|
42
|
+
values(index_by: :symbol) do
|
43
|
+
[
|
44
|
+
GREEN,
|
45
|
+
VIOLET,
|
46
|
+
WHITE,
|
47
|
+
RED
|
48
|
+
]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Convenience alias (American English spelling)
|
53
|
+
Colors = Colours
|
54
|
+
|
55
|
+
# Liturgical season
|
56
|
+
class Season
|
57
|
+
include ValueObjectInterface
|
58
|
+
|
59
|
+
# @param symbol [Symbol] internal identifier
|
60
|
+
# @param colour [Colour]
|
61
|
+
# liturgical colour of the season's Sundays and ferials
|
62
|
+
def initialize(symbol, colour)
|
63
|
+
@symbol = symbol
|
64
|
+
@colour = colour
|
65
|
+
@i18n_key = "temporale.season.#{@symbol}"
|
66
|
+
end
|
67
|
+
|
68
|
+
# Liturgical colour of the season's Sundays and ferials
|
69
|
+
#
|
70
|
+
# @return [Colour]
|
71
|
+
attr_reader :colour
|
72
|
+
end
|
73
|
+
|
74
|
+
# Standard set of liturgical seasons
|
3
75
|
class Seasons < Enum
|
4
|
-
|
76
|
+
ADVENT = Season.new(:advent, Colours::VIOLET)
|
77
|
+
CHRISTMAS = Season.new(:christmas, Colours::WHITE)
|
78
|
+
LENT = Season.new(:lent, Colours::VIOLET)
|
79
|
+
EASTER = Season.new(:easter, Colours::WHITE)
|
80
|
+
ORDINARY = Season.new(:ordinary, Colours::GREEN)
|
81
|
+
|
82
|
+
values(index_by: :symbol) do
|
5
83
|
[
|
6
|
-
ADVENT
|
7
|
-
CHRISTMAS
|
8
|
-
LENT
|
9
|
-
EASTER
|
10
|
-
ORDINARY
|
11
|
-
# is Triduum Sacrum a special season? For now I count Friday and Saturday
|
12
|
-
# to the Lent, Sunday to the Easter time
|
84
|
+
ADVENT,
|
85
|
+
CHRISTMAS,
|
86
|
+
LENT,
|
87
|
+
EASTER,
|
88
|
+
ORDINARY,
|
13
89
|
]
|
14
90
|
end
|
15
91
|
end
|
16
92
|
|
17
|
-
|
93
|
+
# Sunday lectionary cycles.
|
94
|
+
# Values returned by {Calendar#lectionary}
|
95
|
+
LECTIONARY_CYCLES = [:A, :B, :C].freeze
|
18
96
|
|
19
|
-
# ranks of
|
97
|
+
# Celebration ranks as specified in the Table of Liturgical Days
|
20
98
|
class Ranks < Enum
|
99
|
+
TRIDUUM = Rank.new(1.1, 'rank.1_1')
|
100
|
+
PRIMARY = Rank.new(1.2, 'rank.1_2') # description may not be exact
|
101
|
+
SOLEMNITY_GENERAL = Rank.new(1.3, 'rank.1_3', 'rank.short.solemnity') # description may not be exact
|
102
|
+
SOLEMNITY_PROPER = Rank.new(1.4, 'rank.1_4', 'rank.short.solemnity')
|
103
|
+
|
104
|
+
FEAST_LORD_GENERAL = Rank.new(2.5, 'rank.2_5', 'rank.short.feast')
|
105
|
+
SUNDAY_UNPRIVILEGED = Rank.new(2.6, 'rank.2_6', 'rank.short.sunday')
|
106
|
+
FEAST_GENERAL = Rank.new(2.7, 'rank.2_7', 'rank.short.feast')
|
107
|
+
FEAST_PROPER = Rank.new(2.8, 'rank.2_8', 'rank.short.feast')
|
108
|
+
FERIAL_PRIVILEGED = Rank.new(2.9, 'rank.2_9', 'rank.short.ferial')
|
109
|
+
|
110
|
+
MEMORIAL_GENERAL = Rank.new(3.10, 'rank.3_10', 'rank.short.memorial')
|
111
|
+
MEMORIAL_PROPER = Rank.new(3.11, 'rank.3_11', 'rank.short.memorial')
|
112
|
+
MEMORIAL_OPTIONAL = Rank.new(3.12, 'rank.3_12', 'rank.short.memorial_opt')
|
113
|
+
FERIAL = Rank.new(3.13, 'rank.3_13', 'rank.short.ferial')
|
114
|
+
# Not included as a celebration rank on it's own
|
115
|
+
# in the Table of Liturgical Days
|
116
|
+
COMMEMORATION = Rank.new(4.0, 'rank.4_0', 'rank.short.commemoration')
|
117
|
+
|
21
118
|
values(index_by: :priority) do
|
22
119
|
# Values are at the same time references to sections
|
23
120
|
# of the Table of Liturgical Days.
|
24
121
|
# The lower value, the higher rank.
|
25
122
|
[
|
26
|
-
TRIDUUM
|
27
|
-
PRIMARY
|
28
|
-
SOLEMNITY_GENERAL
|
29
|
-
SOLEMNITY_PROPER
|
30
|
-
|
31
|
-
FEAST_LORD_GENERAL = Rank.new(2.5, 'rank.2_5', 'rank.short.feast'),
|
32
|
-
SUNDAY_UNPRIVILEGED = Rank.new(2.6, 'rank.2_6', 'rank.short.sunday'),
|
33
|
-
FEAST_GENERAL = Rank.new(2.7, 'rank.2_7', 'rank.short.feast'),
|
34
|
-
FEAST_PROPER = Rank.new(2.8, 'rank.2_8', 'rank.short.feast'),
|
35
|
-
FERIAL_PRIVILEGED = Rank.new(2.9, 'rank.2_9', 'rank.short.ferial'),
|
36
|
-
|
37
|
-
MEMORIAL_GENERAL = Rank.new(3.10, 'rank.3_10', 'rank.short.memorial'),
|
38
|
-
MEMORIAL_PROPER = Rank.new(3.11, 'rank.3_11', 'rank.short.memorial'),
|
39
|
-
MEMORIAL_OPTIONAL = Rank.new(3.12, 'rank.3_12', 'rank.short.memorial_opt'),
|
40
|
-
FERIAL = Rank.new(3.13, 'rank.3_13', 'rank.short.ferial')
|
41
|
-
]
|
42
|
-
end
|
43
|
-
end
|
123
|
+
TRIDUUM,
|
124
|
+
PRIMARY,
|
125
|
+
SOLEMNITY_GENERAL,
|
126
|
+
SOLEMNITY_PROPER,
|
44
127
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
128
|
+
FEAST_LORD_GENERAL,
|
129
|
+
SUNDAY_UNPRIVILEGED,
|
130
|
+
FEAST_GENERAL,
|
131
|
+
FEAST_PROPER,
|
132
|
+
FERIAL_PRIVILEGED,
|
133
|
+
|
134
|
+
MEMORIAL_GENERAL,
|
135
|
+
MEMORIAL_PROPER,
|
136
|
+
MEMORIAL_OPTIONAL,
|
137
|
+
FERIAL,
|
138
|
+
|
139
|
+
COMMEMORATION,
|
52
140
|
]
|
53
141
|
end
|
54
142
|
end
|
55
|
-
|
56
|
-
Colors = Colours
|
57
143
|
end
|