calendarium-romanum 0.3.0 → 0.7.1
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 +20 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +340 -0
- data/Gemfile +25 -0
- data/Gemfile.lock +86 -0
- data/README.md +515 -0
- data/Rakefile +9 -0
- data/bin/calendariumrom +4 -1
- data/calendarium-romanum.gemspec +26 -0
- data/config/locales/cs.yml +17 -1
- data/config/locales/en.yml +28 -14
- data/config/locales/es.yml +90 -0
- data/config/locales/fr.yml +90 -0
- data/config/locales/it.yml +18 -2
- data/config/locales/la.yml +17 -1
- data/data/README.md +43 -1
- 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 +237 -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/universal-en.txt +214 -211
- data/data/universal-es.txt +243 -0
- data/data/universal-fr.txt +243 -0
- 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 +30 -21
- data/lib/calendarium-romanum/abstract_date.rb +12 -0
- data/lib/calendarium-romanum/calendar.rb +207 -52
- 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 +202 -20
- data/lib/calendarium-romanum/enum.rb +24 -5
- data/lib/calendarium-romanum/enums.rb +102 -36
- data/lib/calendarium-romanum/errors.rb +4 -0
- data/lib/calendarium-romanum/ordinalizer.rb +30 -6
- data/lib/calendarium-romanum/perpetual_calendar.rb +97 -0
- data/lib/calendarium-romanum/rank.rb +43 -6
- data/lib/calendarium-romanum/sanctorale.rb +170 -24
- data/lib/calendarium-romanum/sanctorale_factory.rb +74 -3
- data/lib/calendarium-romanum/sanctorale_loader.rb +176 -0
- data/lib/calendarium-romanum/temporale.rb +251 -119
- data/lib/calendarium-romanum/temporale/celebration_factory.rb +106 -0
- data/lib/calendarium-romanum/temporale/dates.rb +117 -36
- data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +18 -6
- data/lib/calendarium-romanum/transfers.rb +20 -1
- data/lib/calendarium-romanum/util.rb +36 -3
- data/lib/calendarium-romanum/version.rb +5 -1
- metadata +29 -21
- data/lib/calendarium-romanum/sanctoraleloader.rb +0 -115
- data/spec/abstract_date_spec.rb +0 -62
- data/spec/calendar_spec.rb +0 -352
- data/spec/cli_spec.rb +0 -26
- data/spec/data_spec.rb +0 -23
- data/spec/date_spec.rb +0 -61
- data/spec/dates_spec.rb +0 -45
- data/spec/enum_spec.rb +0 -51
- data/spec/i18n_spec.rb +0 -59
- data/spec/rank_spec.rb +0 -42
- data/spec/readme_spec.rb +0 -52
- data/spec/sanctorale_factory_spec.rb +0 -42
- data/spec/sanctorale_spec.rb +0 -167
- data/spec/sanctoraleloader_spec.rb +0 -171
- data/spec/spec_helper.rb +0 -35
- data/spec/temporale_spec.rb +0 -500
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calendarium-romanum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Pavlík
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.5'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.5'
|
83
83
|
description: calendar computations according to the Roman Catholic liturgical calendar
|
84
84
|
as instituted by MP Mysterii Paschalis of Paul VI (1969).
|
85
85
|
email: jkb.pavlik@gmail.com
|
@@ -88,9 +88,22 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".rubocop.yml"
|
94
|
+
- ".travis.yml"
|
95
|
+
- ".yardopts"
|
96
|
+
- CHANGELOG.md
|
97
|
+
- Gemfile
|
98
|
+
- Gemfile.lock
|
99
|
+
- README.md
|
100
|
+
- Rakefile
|
91
101
|
- bin/calendariumrom
|
102
|
+
- calendarium-romanum.gemspec
|
92
103
|
- config/locales/cs.yml
|
93
104
|
- config/locales/en.yml
|
105
|
+
- config/locales/es.yml
|
106
|
+
- config/locales/fr.yml
|
94
107
|
- config/locales/it.yml
|
95
108
|
- config/locales/la.yml
|
96
109
|
- data/README.md
|
@@ -106,43 +119,38 @@ files:
|
|
106
119
|
- data/czech-plzen-cs.txt
|
107
120
|
- data/czech-praha-cs.txt
|
108
121
|
- data/universal-en.txt
|
122
|
+
- data/universal-es.txt
|
123
|
+
- data/universal-fr.txt
|
109
124
|
- data/universal-it.txt
|
110
125
|
- data/universal-la.txt
|
126
|
+
- doc/data_readme.md
|
127
|
+
- doc/images/class_diagram.png
|
128
|
+
- doc/images/class_diagram.puml
|
129
|
+
- doc/yard_readme.rdoc
|
111
130
|
- lib/calendarium-romanum.rb
|
112
131
|
- lib/calendarium-romanum/abstract_date.rb
|
113
132
|
- lib/calendarium-romanum/calendar.rb
|
114
133
|
- lib/calendarium-romanum/cli.rb
|
134
|
+
- lib/calendarium-romanum/cr.rb
|
115
135
|
- lib/calendarium-romanum/data.rb
|
116
136
|
- lib/calendarium-romanum/day.rb
|
117
137
|
- lib/calendarium-romanum/enum.rb
|
118
138
|
- lib/calendarium-romanum/enums.rb
|
139
|
+
- lib/calendarium-romanum/errors.rb
|
119
140
|
- lib/calendarium-romanum/i18n_setup.rb
|
120
141
|
- lib/calendarium-romanum/ordinalizer.rb
|
142
|
+
- lib/calendarium-romanum/perpetual_calendar.rb
|
121
143
|
- lib/calendarium-romanum/rank.rb
|
122
144
|
- lib/calendarium-romanum/sanctorale.rb
|
123
145
|
- lib/calendarium-romanum/sanctorale_factory.rb
|
124
|
-
- lib/calendarium-romanum/
|
146
|
+
- lib/calendarium-romanum/sanctorale_loader.rb
|
125
147
|
- lib/calendarium-romanum/temporale.rb
|
148
|
+
- lib/calendarium-romanum/temporale/celebration_factory.rb
|
126
149
|
- lib/calendarium-romanum/temporale/dates.rb
|
127
150
|
- lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb
|
128
151
|
- lib/calendarium-romanum/transfers.rb
|
129
152
|
- lib/calendarium-romanum/util.rb
|
130
153
|
- lib/calendarium-romanum/version.rb
|
131
|
-
- spec/abstract_date_spec.rb
|
132
|
-
- spec/calendar_spec.rb
|
133
|
-
- spec/cli_spec.rb
|
134
|
-
- spec/data_spec.rb
|
135
|
-
- spec/date_spec.rb
|
136
|
-
- spec/dates_spec.rb
|
137
|
-
- spec/enum_spec.rb
|
138
|
-
- spec/i18n_spec.rb
|
139
|
-
- spec/rank_spec.rb
|
140
|
-
- spec/readme_spec.rb
|
141
|
-
- spec/sanctorale_factory_spec.rb
|
142
|
-
- spec/sanctorale_spec.rb
|
143
|
-
- spec/sanctoraleloader_spec.rb
|
144
|
-
- spec/spec_helper.rb
|
145
|
-
- spec/temporale_spec.rb
|
146
154
|
homepage: http://github.com/igneus/calendarium-romanum
|
147
155
|
licenses:
|
148
156
|
- LGPL-3.0
|
@@ -164,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
172
|
version: '0'
|
165
173
|
requirements: []
|
166
174
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.7.6
|
168
176
|
signing_key:
|
169
177
|
specification_version: 4
|
170
178
|
summary: Roman Catholic liturgical calendar computations
|
@@ -1,115 +0,0 @@
|
|
1
|
-
module CalendariumRomanum
|
2
|
-
|
3
|
-
# understands a plaintext calendar format
|
4
|
-
# and knows how to transform it to Celebrations
|
5
|
-
# and fill them in a Sanctorale
|
6
|
-
#
|
7
|
-
# Format of the file:
|
8
|
-
# 1/31 m : S. Ioannis Bosco, presbyteri
|
9
|
-
#
|
10
|
-
# <month>/<day> <rank shortcut> : <title>
|
11
|
-
# rank shortcut is optional, default value is optional memorial
|
12
|
-
class SanctoraleLoader
|
13
|
-
|
14
|
-
RANK_CODES = {
|
15
|
-
nil => Ranks::MEMORIAL_OPTIONAL,
|
16
|
-
'm' => Ranks::MEMORIAL_GENERAL,
|
17
|
-
'f' => Ranks::FEAST_GENERAL,
|
18
|
-
's' => Ranks::SOLEMNITY_GENERAL
|
19
|
-
}
|
20
|
-
COLOUR_CODES = {
|
21
|
-
nil => Colours::WHITE,
|
22
|
-
'w' => Colours::WHITE,
|
23
|
-
'v' => Colours::VIOLET,
|
24
|
-
'g' => Colours::GREEN,
|
25
|
-
'r' => Colours::RED
|
26
|
-
}
|
27
|
-
|
28
|
-
# dest should be a Sanctorale,
|
29
|
-
# src anything with #each_line
|
30
|
-
def load(src, dest=nil)
|
31
|
-
dest ||= Sanctorale.new
|
32
|
-
|
33
|
-
in_front_matter = false
|
34
|
-
month_section = nil
|
35
|
-
src.each_line.with_index(1) do |l, line_num|
|
36
|
-
# skip YAML front matter
|
37
|
-
if line_num == 1 && l.start_with?('---')
|
38
|
-
in_front_matter = true
|
39
|
-
next
|
40
|
-
elsif in_front_matter
|
41
|
-
if l.start_with?('---')
|
42
|
-
in_front_matter = false
|
43
|
-
end
|
44
|
-
|
45
|
-
next
|
46
|
-
end
|
47
|
-
|
48
|
-
# strip whitespace and comments
|
49
|
-
l.sub!(/#.*/, '')
|
50
|
-
l.strip!
|
51
|
-
next if l.empty?
|
52
|
-
|
53
|
-
# month section heading
|
54
|
-
n = l.match /^=\s*(\d+)\s*$/
|
55
|
-
unless n.nil?
|
56
|
-
month_section = n[1].to_i
|
57
|
-
unless month_section >= 1 && month_section <= 12
|
58
|
-
raise error("Invalid month #{month_section}", line_num)
|
59
|
-
end
|
60
|
-
next
|
61
|
-
end
|
62
|
-
|
63
|
-
# celebration record
|
64
|
-
m = l.match /^((\d+)\/)?(\d+)\s*(([mfs])?(\d\.\d{1,2})?)?\s*([WVRG])?\s*:(.*)$/i
|
65
|
-
if m.nil?
|
66
|
-
raise error("Syntax error, line skipped '#{l}'", line_num)
|
67
|
-
next
|
68
|
-
end
|
69
|
-
|
70
|
-
month, day, rank_char, rank_num, colour, title = m.values_at(2, 3, 5, 6, 7, 8)
|
71
|
-
month ||= month_section
|
72
|
-
day = day.to_i
|
73
|
-
month = month.to_i
|
74
|
-
|
75
|
-
rank = RANK_CODES[rank_char && rank_char.downcase]
|
76
|
-
if rank.nil?
|
77
|
-
raise error("Invalid celebration rank code #{rank_char}", line_num)
|
78
|
-
end
|
79
|
-
|
80
|
-
if rank_num
|
81
|
-
rank_num = rank_num.to_f
|
82
|
-
rank_by_num = Ranks[rank_num]
|
83
|
-
|
84
|
-
if rank_by_num.nil?
|
85
|
-
raise error("Invalid celebration rank code #{rank_num}", line_num)
|
86
|
-
elsif rank_char && (rank.priority.to_i != rank_by_num.priority.to_i)
|
87
|
-
raise error("Invalid combination of rank letter #{rank_char.inspect} and number #{rank_num}.", line_num)
|
88
|
-
end
|
89
|
-
|
90
|
-
rank = rank_by_num
|
91
|
-
end
|
92
|
-
|
93
|
-
dest.add month, day, Celebration.new(
|
94
|
-
title.strip,
|
95
|
-
rank,
|
96
|
-
COLOUR_CODES[colour && colour.downcase]
|
97
|
-
)
|
98
|
-
end
|
99
|
-
|
100
|
-
dest
|
101
|
-
end
|
102
|
-
|
103
|
-
alias_method :load_from_string, :load
|
104
|
-
|
105
|
-
def load_from_file(filename, dest=nil, encoding='utf-8')
|
106
|
-
self.load File.open(filename, 'r', encoding: encoding), dest
|
107
|
-
end
|
108
|
-
|
109
|
-
private
|
110
|
-
|
111
|
-
def error(message, line_number)
|
112
|
-
RuntimeError.new("L#{line_number}: #{message}")
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
data/spec/abstract_date_spec.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
describe CR::AbstractDate do
|
4
|
-
AD = CR::AbstractDate
|
5
|
-
|
6
|
-
describe '.new' do
|
7
|
-
describe 'fails on invalid' do
|
8
|
-
it 'month' do
|
9
|
-
expect do
|
10
|
-
AD.new(13, 1)
|
11
|
-
end.to raise_exception /Invalid month/
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'day' do
|
15
|
-
expect do
|
16
|
-
AD.new(1, 32)
|
17
|
-
end.to raise_exception /Invalid day/
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'day of month' do
|
21
|
-
expect do
|
22
|
-
AD.new(2, 30)
|
23
|
-
end.to raise_exception /Invalid day/
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# test .new through .from_date on a complete leap year
|
29
|
-
describe '.from_date' do
|
30
|
-
YEAR = 2000
|
31
|
-
|
32
|
-
it 'the test year is leap' do
|
33
|
-
expect(Date.new(YEAR)).to be_leap
|
34
|
-
end
|
35
|
-
|
36
|
-
CR::Util::Year.new(YEAR).each do |date|
|
37
|
-
it date.to_s do
|
38
|
-
expect do
|
39
|
-
AD.from_date date
|
40
|
-
end.not_to raise_exception
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#<' do
|
46
|
-
it { expect(AD.new(1, 1)).to be < AD.new(1, 2) }
|
47
|
-
it { expect(AD.new(1, 1)).to be < AD.new(2, 1) }
|
48
|
-
it { expect(AD.new(1, 1)).not_to be < AD.new(1, 1) }
|
49
|
-
end
|
50
|
-
|
51
|
-
describe '#==' do
|
52
|
-
it { expect(AD.new(1, 1)).to be == AD.new(1, 1) }
|
53
|
-
it { expect(AD.new(1, 1)).not_to be == AD.new(1, 2) }
|
54
|
-
end
|
55
|
-
|
56
|
-
describe 'as a Hash key' do
|
57
|
-
it 'different objects with the same values are considered same key' do
|
58
|
-
h = {AD.new(1, 1) => 1}
|
59
|
-
expect(h).to have_key AD.new(1, 1)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
data/spec/calendar_spec.rb
DELETED
@@ -1,352 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
describe CR::Calendar do
|
4
|
-
|
5
|
-
describe 'core functions' do
|
6
|
-
before :all do
|
7
|
-
@c = described_class.new 2013
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#==' do
|
11
|
-
it 'considers calendars with the same year same' do
|
12
|
-
expect(described_class.new(2014) == described_class.new(2014)).to be true
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'considers calendars with different year different' do
|
16
|
-
expect(described_class.new(2014) == described_class.new(2010)).to be false
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#lectionary' do
|
21
|
-
it 'detects correctly' do
|
22
|
-
expect(described_class.new(2014).lectionary).to eq :B
|
23
|
-
expect(described_class.new(2013).lectionary).to eq :A
|
24
|
-
expect(described_class.new(2012).lectionary).to eq :C
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#ferial_lectionary' do
|
29
|
-
it 'detects correctly' do
|
30
|
-
expect(described_class.new(2014).ferial_lectionary).to eq 1
|
31
|
-
expect(described_class.new(2013).ferial_lectionary).to eq 2
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '.for_day' do
|
36
|
-
it 'continues the previous year\'s calendar in summer' do
|
37
|
-
expect(described_class.for_day(Date.new(2014, 6, 9))).to eq described_class.new(2013)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'provides the current year\'s calendar in December' do
|
41
|
-
expect(described_class.for_day(Date.new(2014, 12, 20))).to eq described_class.new(2014)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#day' do
|
46
|
-
describe 'received arguments' do
|
47
|
-
describe 'Date' do
|
48
|
-
it 'returns a Day' do
|
49
|
-
expect(@c.day(Date.new(2013, 12, 10))).to be_a CR::Day
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'DateTime' do
|
54
|
-
it 'returns a Day' do
|
55
|
-
expect(@c.day(DateTime.new(2013, 12, 10, 12, 10, 0))).to be_a CR::Day
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'three Integers' do
|
60
|
-
it 'returns a Day' do
|
61
|
-
expect(@c.day(2013, 12, 10)).to be_a CR::Day
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe 'two integers' do
|
66
|
-
describe 'autumn' do
|
67
|
-
it 'supplies year' do
|
68
|
-
day = @c.day(12, 10)
|
69
|
-
expect(day).to be_a CR::Day
|
70
|
-
expect(day.date).to eq Date.new(2013, 12, 10)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe 'spring' do
|
75
|
-
it 'supplies year' do
|
76
|
-
day = @c.day(4, 10)
|
77
|
-
expect(day).to be_a CR::Day
|
78
|
-
expect(day.date).to eq Date.new(2014, 4, 10)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe 'invalid' do
|
83
|
-
describe 'absolutely' do
|
84
|
-
it 'fails' do
|
85
|
-
expect do
|
86
|
-
day = @c.day(0, 34)
|
87
|
-
end.to raise_exception(ArgumentError, 'invalid date')
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe 'for the given year' do
|
92
|
-
it 'fails' do
|
93
|
-
expect do
|
94
|
-
day = @c.day(2, 29)
|
95
|
-
end.to raise_exception(ArgumentError, 'invalid date')
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'throws RangeError if given date not included in the year' do
|
103
|
-
expect { @c.day(2000, 1, 1) }.to raise_error RangeError
|
104
|
-
end
|
105
|
-
|
106
|
-
describe 'temporale features' do
|
107
|
-
describe 'season' do
|
108
|
-
it 'detects Advent correctly' do
|
109
|
-
expect(@c.day(2013, 12, 10).season).to eq CR::Seasons::ADVENT
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe 'week of the season' do
|
114
|
-
describe 'Advent' do
|
115
|
-
it 'sets Advent week correctly' do
|
116
|
-
expect(@c.day(2013, 12, 10).season_week).to eq 2
|
117
|
-
expect(@c.day(2013, 12, 15).season_week).to eq 3
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe 'Christmas' do
|
122
|
-
it 'days before the first Sunday are week 0' do
|
123
|
-
expect(@c.day(2013, 12, 25).season_week).to eq 0
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'first Sunday starts week 1' do
|
127
|
-
expect(@c.day(2013, 12, 29).season_week).to eq 1
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe 'Lent' do
|
132
|
-
it 'Ash Wednesday is week 0' do
|
133
|
-
expect(@c.day(2014, 3, 5).season_week).to eq 0
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
describe 'Easter' do
|
138
|
-
it 'Easter Sunday opens week 1' do
|
139
|
-
expect(@c.day(2014, 4, 20).season_week).to eq 1
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe 'Ordinary time' do
|
144
|
-
it 'Monday after Baptism of the Lord is week 1' do
|
145
|
-
expect(@c.day(2014, 1, 13).season_week).to eq 1
|
146
|
-
end
|
147
|
-
|
148
|
-
describe 'after Pentecost' do
|
149
|
-
it '2014' do
|
150
|
-
c = described_class.new(2013)
|
151
|
-
expect(c.day(2014, 6, 9).season_week).to eq 10
|
152
|
-
end
|
153
|
-
|
154
|
-
it '2015' do
|
155
|
-
c = described_class.new(2014)
|
156
|
-
expect(c.day(2015, 5, 25).season_week).to eq 8
|
157
|
-
end
|
158
|
-
|
159
|
-
it '2016' do
|
160
|
-
c = described_class.new(2015)
|
161
|
-
expect(c.day(2016, 5, 16).season_week).to eq 7
|
162
|
-
end
|
163
|
-
|
164
|
-
it '2017' do
|
165
|
-
c = described_class.new(2016)
|
166
|
-
expect(c.day(2017, 6, 5).season_week).to eq 9
|
167
|
-
end
|
168
|
-
|
169
|
-
describe 'works correctly for the whole week' do
|
170
|
-
describe 'first' do
|
171
|
-
Date.new(2014, 6, 9).upto(Date.new(2014, 6, 14)) do |date|
|
172
|
-
it date do
|
173
|
-
expect(@c.day(date).season_week).to eq 10
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
describe 'second' do
|
179
|
-
Date.new(2014, 6, 15).upto(Date.new(2014, 6, 21)) do |date|
|
180
|
-
it date do
|
181
|
-
expect(@c.day(date).season_week).to eq 11
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
describe 'second last' do
|
187
|
-
Date.new(2014, 11, 16).upto(Date.new(2014, 11, 22)) do |date|
|
188
|
-
it date do
|
189
|
-
expect(@c.day(date).season_week).to eq 33
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
describe 'last' do
|
195
|
-
Date.new(2014, 11, 23).upto(Date.new(2014, 11, 29)) do |date|
|
196
|
-
it date do
|
197
|
-
expect(@c.day(date).season_week).to eq 34
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
describe 'Temporale x Sanctorale resolution' do
|
208
|
-
before :all do
|
209
|
-
@s = CR::Data::GENERAL_ROMAN_ENGLISH.load
|
210
|
-
@c = described_class.new 2013, @s
|
211
|
-
end
|
212
|
-
|
213
|
-
it '"empty" day results in a ferial' do
|
214
|
-
d = @c.day(7, 2)
|
215
|
-
expect(d.celebrations.size).to eq 1
|
216
|
-
expect(d.celebrations[0].rank).to eq CR::Ranks::FERIAL
|
217
|
-
end
|
218
|
-
|
219
|
-
it 'sanctorale feast' do
|
220
|
-
d = @c.day(7, 3)
|
221
|
-
expect(d.celebrations.size).to eq 1
|
222
|
-
expect(d.celebrations[0].rank).to eq CR::Ranks::FEAST_GENERAL
|
223
|
-
expect(d.celebrations[0].title).to include 'Thomas'
|
224
|
-
end
|
225
|
-
|
226
|
-
it 'optional memorial does not suppress ferial' do
|
227
|
-
d = @c.day(7, 14)
|
228
|
-
expect(d.celebrations.size).to eq 2
|
229
|
-
|
230
|
-
expect(d.celebrations[0].rank).to eq CR::Ranks::FERIAL
|
231
|
-
|
232
|
-
expect(d.celebrations[1].rank).to eq CR::Ranks::MEMORIAL_OPTIONAL
|
233
|
-
expect(d.celebrations[1].title).to include 'Lellis'
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'obligatory memorial does suppress ferial' do
|
237
|
-
d = @c.day(1, 17)
|
238
|
-
expect(d.celebrations.size).to eq 1
|
239
|
-
|
240
|
-
expect(d.celebrations[0].rank).to eq CR::Ranks::MEMORIAL_GENERAL
|
241
|
-
end
|
242
|
-
|
243
|
-
it 'memorial in Lent becomes mere commemoration' do
|
244
|
-
d = @c.day(4, 2)
|
245
|
-
expect(d.celebrations.size).to eq 2
|
246
|
-
|
247
|
-
comm = d.celebrations[1]
|
248
|
-
expect(comm.rank).to eq CR::Ranks::COMMEMORATION
|
249
|
-
expect(comm.title).to eq 'Saint Francis of Paola, hermit'
|
250
|
-
end
|
251
|
-
|
252
|
-
it 'Sunday suppresses feast' do
|
253
|
-
san = CR::Sanctorale.new
|
254
|
-
|
255
|
-
d = Date.new 2015, 6, 28
|
256
|
-
expect(d).to be_sunday # ensure
|
257
|
-
san.add d.month, d.day, CR::Celebration.new('St. None, programmer', CR::Ranks::FEAST_GENERAL)
|
258
|
-
|
259
|
-
c = described_class.new 2014, san
|
260
|
-
|
261
|
-
celebs = c.day(d).celebrations
|
262
|
-
expect(celebs.size).to eq 1
|
263
|
-
expect(celebs[0].rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
|
264
|
-
end
|
265
|
-
|
266
|
-
it 'suppressed fictive solemnity is transferred' do
|
267
|
-
san = CR::Sanctorale.new
|
268
|
-
|
269
|
-
d = CR::Temporale.new(2014).good_friday
|
270
|
-
st_none = CR::Celebration.new('St. None, abbot, founder of the Order of Programmers (OProg)', CR::Ranks::SOLEMNITY_PROPER)
|
271
|
-
san.add d.month, d.day, st_none
|
272
|
-
|
273
|
-
c = described_class.new 2014, san
|
274
|
-
|
275
|
-
# Good Friday suppresses the solemnity
|
276
|
-
celebs = c.day(d).celebrations
|
277
|
-
expect(celebs.size).to eq 1
|
278
|
-
expect(celebs[0].rank).to eq CR::Ranks::TRIDUUM
|
279
|
-
expect(celebs[0].title).to have_translation 'Friday of the Passion of the Lord'
|
280
|
-
|
281
|
-
# it is transferred on a day after the Easter octave
|
282
|
-
d = c.temporale.easter_sunday + 8
|
283
|
-
celebs = c.day(d).celebrations
|
284
|
-
expect(celebs.size).to eq 1
|
285
|
-
expect(celebs[0]).to eq st_none
|
286
|
-
end
|
287
|
-
|
288
|
-
it 'transfer of suppressed Annunciation (real world example)' do
|
289
|
-
c = described_class.new 2015, @s
|
290
|
-
|
291
|
-
d = Date.new(2016, 3, 25)
|
292
|
-
|
293
|
-
# Good Friday suppresses the solemnity
|
294
|
-
celebs = c.day(d).celebrations
|
295
|
-
expect(celebs.size).to eq 1
|
296
|
-
expect(celebs[0].rank).to eq CR::Ranks::TRIDUUM
|
297
|
-
expect(celebs[0].title).to have_translation 'Friday of the Passion of the Lord'
|
298
|
-
|
299
|
-
# it is transferred on a day after the Easter octave
|
300
|
-
d = c.temporale.easter_sunday + 8
|
301
|
-
celebs = c.day(d).celebrations
|
302
|
-
expect(celebs.size).to eq 1
|
303
|
-
expect(celebs[0].title).to eq 'Annunciation of the Lord'
|
304
|
-
end
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
describe '#pred' do
|
309
|
-
it 'returns a calendar for the previous year' do
|
310
|
-
new_cal = @c.pred
|
311
|
-
expect(new_cal.year).to eq(@c.year - 1)
|
312
|
-
expect(new_cal.sanctorale).to eq (@c.sanctorale)
|
313
|
-
end
|
314
|
-
|
315
|
-
it 'preserves sanctorale' do
|
316
|
-
sanctorale = CR::Sanctorale.new
|
317
|
-
cal = described_class.new(2000, sanctorale)
|
318
|
-
new_cal = cal.pred
|
319
|
-
expect(new_cal.sanctorale).to be sanctorale
|
320
|
-
end
|
321
|
-
|
322
|
-
it 'preserves temporale class' do
|
323
|
-
t_class = Class.new(CR::Temporale)
|
324
|
-
cal = described_class.new(2000, nil, t_class)
|
325
|
-
new_cal = cal.pred
|
326
|
-
expect(new_cal.temporale).to be_a t_class
|
327
|
-
end
|
328
|
-
end
|
329
|
-
|
330
|
-
describe '#succ' do
|
331
|
-
it 'returns a calendar for the subsequent year' do
|
332
|
-
new_cal = @c.succ
|
333
|
-
expect(new_cal.year).to eq(@c.year + 1)
|
334
|
-
expect(new_cal.sanctorale).to eq (@c.sanctorale)
|
335
|
-
end
|
336
|
-
|
337
|
-
it 'preserves sanctorale' do
|
338
|
-
sanctorale = CR::Sanctorale.new
|
339
|
-
cal = described_class.new(2000, sanctorale)
|
340
|
-
new_cal = cal.succ
|
341
|
-
expect(new_cal.sanctorale).to be sanctorale
|
342
|
-
end
|
343
|
-
|
344
|
-
it 'preserves temporale class' do
|
345
|
-
t_class = Class.new(CR::Temporale)
|
346
|
-
cal = described_class.new(2000, nil, t_class)
|
347
|
-
new_cal = cal.succ
|
348
|
-
expect(new_cal.temporale).to be_a t_class
|
349
|
-
end
|
350
|
-
end
|
351
|
-
end
|
352
|
-
end
|