calendarium-romanum 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ee4894a3821935522076c8a8c749be997e243ee
4
- data.tar.gz: bbc5bc6e3c9dd24427eac5d9bef2fa51a73122e3
3
+ metadata.gz: 0526a7a790d2135fa159e4651fb9485edb8f6cdb
4
+ data.tar.gz: fe9ea9ee54d80c028c4a8db3afd9ed437b367483
5
5
  SHA512:
6
- metadata.gz: 0d38d06d95abf7994515a338fff2cf2b08970b2a19952eb39132ccc058f4c2e19e6673267461a4fd0e41dd4e95618cc2a8067981ded24c9477f27743bdd8c5f3
7
- data.tar.gz: 79b0b9fa0aaaf6f1a2fbec31661b53c15b38fd4b60e23d8585813cbc61c4b3f73dd5a8978d6e52deda6e76be19c2833f73d92ba92ba93fa9e88f7899589e67ca
6
+ metadata.gz: 69ae6254d0cb70de6c7769f3a6734a39bc0432fd22a3cc619c765986638763e206bd29d1e20ba3ceecfc232d368c7d2fd783e14b4bfb0211a84ef46103f4b29c
7
+ data.tar.gz: 55442b152e1179e9a0a1d571723859b2815d875fe331f22f60ca45a0ba9b97db8094b5fe202eef4c07c06f9cff6b4d03bf79ec3e0d73092370ea205edaa60b4a
@@ -1,4 +1,5 @@
1
1
  %w{
2
+ version
2
3
  enums
3
4
  calendar
4
5
  temporale
@@ -357,7 +357,8 @@ module CalendariumRomanum
357
357
 
358
358
  {
359
359
  nativity: ['The Nativity of the Lord', nil, nil],
360
- holy_family: ['The Holy Family of Jesus, Mary and Joseph', Ranks::PRIMARY, nil],
360
+ holy_family: ['The Holy Family of Jesus, Mary and Joseph', Ranks::FEAST_LORD_GENERAL, nil],
361
+ mother_of_god: ['Octave Day of Christmas, of Mary, Mother of God', Ranks::SOLEMNITY_GENERAL],
361
362
  epiphany: ['The Epiphany of the Lord', nil, nil],
362
363
  baptism_of_lord: ['The Baptism of the Lord', Ranks::FEAST_LORD_GENERAL, nil],
363
364
  good_friday: ['Friday of the Passion of the Lord', Ranks::TRIDUUM, Colours::RED],
@@ -0,0 +1,3 @@
1
+ module CalendariumRomanum
2
+ VERSION = '0.0.3'
3
+ end
@@ -1,7 +1,7 @@
1
1
  require_relative 'spec_helper'
2
2
 
3
- describe AbstractDate do
4
- AD = AbstractDate
3
+ describe CR::AbstractDate do
4
+ AD = CR::AbstractDate
5
5
 
6
6
  describe '.new' do
7
7
  describe 'fails on invalid' do
@@ -1,50 +1,50 @@
1
1
  require_relative 'spec_helper'
2
2
 
3
- describe Calendar do
3
+ describe CR::Calendar do
4
4
 
5
5
  describe 'core functions' do
6
6
  before :all do
7
- @c = Calendar.new 2013
7
+ @c = described_class.new 2013
8
8
  end
9
9
 
10
10
  describe '#==' do
11
11
  it 'considers calendars with the same year same' do
12
- Calendar.new(2014).should == Calendar.new(2014)
12
+ described_class.new(2014).should == described_class.new(2014)
13
13
  end
14
14
 
15
15
  it 'considers calendars with different year different' do
16
- Calendar.new(2014).should_not == Calendar.new(2010)
16
+ described_class.new(2014).should_not == described_class.new(2010)
17
17
  end
18
18
  end
19
19
 
20
20
  describe '#lectionary' do
21
21
  it 'detects correctly' do
22
- Calendar.new(2014).lectionary.should eq :B
23
- Calendar.new(2013).lectionary.should eq :A
24
- Calendar.new(2012).lectionary.should eq :C
22
+ described_class.new(2014).lectionary.should eq :B
23
+ described_class.new(2013).lectionary.should eq :A
24
+ described_class.new(2012).lectionary.should eq :C
25
25
  end
26
26
  end
27
27
 
28
28
  describe '#ferial_lectionary' do
29
29
  it 'detects correctly' do
30
- Calendar.new(2014).ferial_lectionary.should eq 1
31
- Calendar.new(2013).ferial_lectionary.should eq 2
30
+ described_class.new(2014).ferial_lectionary.should eq 1
31
+ described_class.new(2013).ferial_lectionary.should eq 2
32
32
  end
33
33
  end
34
34
 
35
35
  describe '.for_day' do
36
36
  it 'continues the previous year\'s calendar in summer' do
37
- Calendar.for_day(Date.new(2014, 6, 9)).should eq Calendar.new(2013)
37
+ described_class.for_day(Date.new(2014, 6, 9)).should eq described_class.new(2013)
38
38
  end
39
39
 
40
40
  it 'provides the current year\'s calendar in December' do
41
- Calendar.for_day(Date.new(2014, 12, 20)).should eq Calendar.new(2014)
41
+ described_class.for_day(Date.new(2014, 12, 20)).should eq described_class.new(2014)
42
42
  end
43
43
  end
44
44
 
45
45
  describe '#day' do
46
46
  it 'returns a Day' do
47
- @c.day(2013, 12, 10).should be_a Day
47
+ @c.day(2013, 12, 10).should be_a CR::Day
48
48
  end
49
49
 
50
50
  it 'inserts correct year if not given' do
@@ -106,22 +106,22 @@ describe Calendar do
106
106
 
107
107
  describe 'Temporale x Sanctorale resolution' do
108
108
  before :all do
109
- @s = Sanctorale.new
110
- loader = SanctoraleLoader.new
109
+ @s = CR::Sanctorale.new
110
+ loader = CR::SanctoraleLoader.new
111
111
  loader.load_from_file(@s, File.join(File.dirname(__FILE__), '..', 'data', 'universal-en.txt'))
112
- @c = Calendar.new 2013, @s
112
+ @c = described_class.new 2013, @s
113
113
  end
114
114
 
115
115
  it '"empty" day results in a ferial' do
116
116
  d = @c.day(7, 2)
117
117
  expect(d.celebrations.size).to eq 1
118
- expect(d.celebrations[0].rank).to eq FERIAL
118
+ expect(d.celebrations[0].rank).to eq CR::Ranks::FERIAL
119
119
  end
120
120
 
121
121
  it 'sanctorale feast' do
122
122
  d = @c.day(7, 3)
123
123
  expect(d.celebrations.size).to eq 1
124
- expect(d.celebrations[0].rank).to eq FEAST_GENERAL
124
+ expect(d.celebrations[0].rank).to eq CR::Ranks::FEAST_GENERAL
125
125
  expect(d.celebrations[0].title).to include 'Thomas'
126
126
  end
127
127
 
@@ -129,9 +129,9 @@ describe Calendar do
129
129
  d = @c.day(7, 14)
130
130
  expect(d.celebrations.size).to eq 2
131
131
 
132
- expect(d.celebrations[0].rank).to eq FERIAL
132
+ expect(d.celebrations[0].rank).to eq CR::Ranks::FERIAL
133
133
 
134
- expect(d.celebrations[1].rank).to eq MEMORIAL_OPTIONAL
134
+ expect(d.celebrations[1].rank).to eq CR::Ranks::MEMORIAL_OPTIONAL
135
135
  expect(d.celebrations[1].title).to include 'Lellis'
136
136
  end
137
137
 
@@ -139,36 +139,36 @@ describe Calendar do
139
139
  d = @c.day(1, 17)
140
140
  expect(d.celebrations.size).to eq 1
141
141
 
142
- expect(d.celebrations[0].rank).to eq MEMORIAL_GENERAL
142
+ expect(d.celebrations[0].rank).to eq CR::Ranks::MEMORIAL_GENERAL
143
143
  end
144
144
 
145
145
  it 'Sunday suppresses feast' do
146
- san = Sanctorale.new
146
+ san = CR::Sanctorale.new
147
147
 
148
148
  d = Date.new 2015, 6, 28
149
149
  expect(d).to be_sunday # ensure
150
- san.add d.month, d.day, Celebration.new('St. None, programmer', FEAST_GENERAL)
150
+ san.add d.month, d.day, CR::Celebration.new('St. None, programmer', CR::Ranks::FEAST_GENERAL)
151
151
 
152
- c = Calendar.new 2014, san
152
+ c = described_class.new 2014, san
153
153
 
154
154
  celebs = c.day(d).celebrations
155
155
  expect(celebs.size).to eq 1
156
- expect(celebs[0].rank).to eq SUNDAY_UNPRIVILEGED
156
+ expect(celebs[0].rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
157
157
  end
158
158
 
159
159
  it 'suppressed fictive solemnity is transferred' do
160
- san = Sanctorale.new
160
+ san = CR::Sanctorale.new
161
161
 
162
- d = Temporale.new(2014).good_friday
163
- st_none = Celebration.new('St. None, abbot, founder of the Order of Programmers (OProg)', SOLEMNITY_PROPER)
162
+ d = CR::Temporale.new(2014).good_friday
163
+ st_none = CR::Celebration.new('St. None, abbot, founder of the Order of Programmers (OProg)', CR::Ranks::SOLEMNITY_PROPER)
164
164
  san.add d.month, d.day, st_none
165
165
 
166
- c = Calendar.new 2014, san
166
+ c = described_class.new 2014, san
167
167
 
168
168
  # Good Friday suppresses the solemnity
169
169
  celebs = c.day(d).celebrations
170
170
  expect(celebs.size).to eq 1
171
- expect(celebs[0].rank).to eq TRIDUUM
171
+ expect(celebs[0].rank).to eq CR::Ranks::TRIDUUM
172
172
  expect(celebs[0].title).to eq 'Friday of the Passion of the Lord'
173
173
 
174
174
  # it is transferred on a day after the Easter octave
@@ -179,14 +179,14 @@ describe Calendar do
179
179
  end
180
180
 
181
181
  it 'transfer of suppressed Annunciation (real world example)' do
182
- c = Calendar.new 2015, @s
182
+ c = described_class.new 2015, @s
183
183
 
184
184
  d = Date.new(2016, 3, 25)
185
185
 
186
186
  # Good Friday suppresses the solemnity
187
187
  celebs = c.day(d).celebrations
188
188
  expect(celebs.size).to eq 1
189
- expect(celebs[0].rank).to eq TRIDUUM
189
+ expect(celebs[0].rank).to eq CR::Ranks::TRIDUUM
190
190
  expect(celebs[0].title).to eq 'Friday of the Passion of the Lord'
191
191
 
192
192
  # it is transferred on a day after the Easter octave
data/spec/rank_spec.rb CHANGED
@@ -1,30 +1,30 @@
1
1
  require_relative 'spec_helper'
2
2
 
3
- describe Rank do
3
+ describe CR::Rank do
4
4
  describe 'comparison' do
5
5
  it 'memorial x ferial' do
6
- expect(MEMORIAL_GENERAL).to be > FERIAL
6
+ expect(CR::Ranks::MEMORIAL_GENERAL).to be > CR::Ranks::FERIAL
7
7
  end
8
8
  end
9
9
 
10
10
  describe '[]' do
11
11
  it 'has all existing instances indexed by rank number' do
12
- expect(Ranks[1.1]).to eq Ranks::TRIDUUM
12
+ expect(CR::Ranks[1.1]).to eq CR::Ranks::TRIDUUM
13
13
  end
14
14
  end
15
15
 
16
16
  describe '#<' do
17
- it { expect(Ranks[1.2]).to be < Ranks[1.1] }
18
- it { expect(Ranks[1.1]).not_to be < Ranks[1.2] }
17
+ it { expect(CR::Ranks[1.2]).to be < CR::Ranks[1.1] }
18
+ it { expect(CR::Ranks[1.1]).not_to be < CR::Ranks[1.2] }
19
19
  end
20
20
 
21
21
  describe '#>' do
22
- it { expect(Ranks[1.1]).to be > Ranks[1.2] }
23
- it { expect(Ranks[1.2]).not_to be > Ranks[1.1] }
22
+ it { expect(CR::Ranks[1.1]).to be > CR::Ranks[1.2] }
23
+ it { expect(CR::Ranks[1.2]).not_to be > CR::Ranks[1.1] }
24
24
  end
25
25
 
26
26
  describe '#==' do
27
- it { expect(Ranks[1.2]).to be == Ranks[1.2] }
28
- it { expect(Ranks[1.2]).not_to be == Ranks[1.1] }
27
+ it { expect(CR::Ranks[1.2]).to be == CR::Ranks[1.2] }
28
+ it { expect(CR::Ranks[1.2]).not_to be == CR::Ranks[1.1] }
29
29
  end
30
30
  end
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Sanctorale do
3
+ describe CR::Sanctorale do
4
4
  before :each do
5
- @s = Sanctorale.new
5
+ @s = described_class.new
6
6
  end
7
7
 
8
8
  describe '#get' do
@@ -14,7 +14,7 @@ describe Sanctorale do
14
14
 
15
15
  describe 'for unempty day' do
16
16
  before :each do
17
- @c = Celebration.new('S. Antonii, abbatis', Ranks::MEMORIAL_GENERAL)
17
+ @c = CR::Celebration.new('S. Antonii, abbatis', CR::Ranks::MEMORIAL_GENERAL)
18
18
  @s.add 1, 17, @c
19
19
  end
20
20
 
@@ -26,43 +26,43 @@ describe Sanctorale do
26
26
  expect(@s.get(Date.new(2014, 1, 17))).to eq [@c]
27
27
  end
28
28
 
29
- it 'may have more Celebrations for a day' do
29
+ it 'may have more CR::Celebrations for a day' do
30
30
  [
31
31
  'S. Fabiani, papae et martyris',
32
32
  'S. Sebastiani, martyris'
33
- ].each {|t| @s.add 1, 20, Celebration.new(t) }
33
+ ].each {|t| @s.add 1, 20, CR::Celebration.new(t) }
34
34
  expect(@s.get(1, 20).size).to eq 2
35
35
  end
36
36
  end
37
37
  end
38
38
 
39
39
  describe '#add' do
40
- it 'adds a Celebration to one month only' do
41
- @s.add 1, 17, Celebration.new('S. Antonii, abbatis', Ranks::MEMORIAL_GENERAL)
40
+ it 'adds a CR::Celebration to one month only' do
41
+ @s.add 1, 17, CR::Celebration.new('S. Antonii, abbatis', CR::Ranks::MEMORIAL_GENERAL)
42
42
  expect(@s.get(2, 17)).to be_empty
43
43
  end
44
44
 
45
45
  it 'does not allow month 0' do
46
- expect { @s.add 0, 1, Celebration.new('S. Nullius') }.to raise_exception RangeError
46
+ expect { @s.add 0, 1, CR::Celebration.new('S. Nullius') }.to raise_exception RangeError
47
47
  end
48
48
 
49
49
  it 'does not allow month higher than 12' do
50
- expect { @s.add 13, 1, Celebration.new('S. Nullius') }.to raise_exception RangeError
50
+ expect { @s.add 13, 1, CR::Celebration.new('S. Nullius') }.to raise_exception RangeError
51
51
  end
52
52
 
53
53
  it 'adds solemnity to a dedicated container' do
54
- expect { @s.add 1, 13, Celebration.new('S. Nullius', Ranks::SOLEMNITY_PROPER) }.to change { @s.solemnities.size }.by 1
54
+ expect { @s.add 1, 13, CR::Celebration.new('S. Nullius', CR::Ranks::SOLEMNITY_PROPER) }.to change { @s.solemnities.size }.by 1
55
55
  end
56
56
 
57
57
  it 'does not add non-solemnity to solemnities' do
58
- expect { @s.add 1, 13, Celebration.new('S. Nullius') }.not_to change { @s.solemnities.size }
58
+ expect { @s.add 1, 13, CR::Celebration.new('S. Nullius') }.not_to change { @s.solemnities.size }
59
59
  end
60
60
  end
61
61
 
62
62
  describe '#replace' do
63
63
  it 'replaces the original celebration(s)' do
64
- nemo = Celebration.new('S. Nullius')
65
- nonus = Celebration.new('S. Noni', Ranks::SOLEMNITY_PROPER)
64
+ nemo = CR::Celebration.new('S. Nullius')
65
+ nonus = CR::Celebration.new('S. Noni', CR::Ranks::SOLEMNITY_PROPER)
66
66
 
67
67
  @s.add 1, 13, nemo
68
68
  @s.replace 1, 13, [nonus]
@@ -71,15 +71,15 @@ describe Sanctorale do
71
71
  end
72
72
 
73
73
  it 'adds solemnity to a dedicated container' do
74
- nonus = Celebration.new('S. Noni', Ranks::SOLEMNITY_PROPER)
74
+ nonus = CR::Celebration.new('S. Noni', CR::Ranks::SOLEMNITY_PROPER)
75
75
  expect do
76
76
  @s.replace 1, 13, [nonus]
77
77
  end.to change { @s.solemnities.size }.by 1
78
78
  end
79
79
 
80
80
  it 'removes solemnity' do
81
- nemo = Celebration.new('S. Nullius', Ranks::SOLEMNITY_PROPER)
82
- nonus = Celebration.new('S. Noni')
81
+ nemo = CR::Celebration.new('S. Nullius', CR::Ranks::SOLEMNITY_PROPER)
82
+ nonus = CR::Celebration.new('S. Noni')
83
83
 
84
84
  @s.add 1, 13, nemo
85
85
  expect do
@@ -90,11 +90,11 @@ describe Sanctorale do
90
90
 
91
91
  describe '#update' do
92
92
  before :each do
93
- @s2 = Sanctorale.new
93
+ @s2 = described_class.new
94
94
  end
95
95
 
96
96
  it 'adds entries from the argument to receiver' do
97
- @s2.add 1, 17, Celebration.new('S. Antonii, abbatis', Ranks::MEMORIAL_GENERAL)
97
+ @s2.add 1, 17, CR::Celebration.new('S. Antonii, abbatis', CR::Ranks::MEMORIAL_GENERAL)
98
98
 
99
99
  expect(@s).to be_empty
100
100
  @s.update @s2
@@ -102,8 +102,8 @@ describe Sanctorale do
102
102
  end
103
103
 
104
104
  it 'overwrites eventual previous content of the day' do
105
- @s.add 1, 17, Celebration.new('S. Antonii, abbatis', Ranks::MEMORIAL_GENERAL)
106
- cele = Celebration.new('S. Nulius, monachi')
105
+ @s.add 1, 17, CR::Celebration.new('S. Antonii, abbatis', CR::Ranks::MEMORIAL_GENERAL)
106
+ cele = CR::Celebration.new('S. Nulius, monachi')
107
107
  @s2.add 1, 17, cele
108
108
 
109
109
  @s.update @s2
@@ -117,7 +117,7 @@ describe Sanctorale do
117
117
  end
118
118
 
119
119
  it 'knows when there is something' do
120
- @s.add 1, 17, Celebration.new('S. Antonii, abbatis', Ranks::MEMORIAL_GENERAL)
120
+ @s.add 1, 17, CR::Celebration.new('S. Antonii, abbatis', CR::Ranks::MEMORIAL_GENERAL)
121
121
  expect(@s.size).to eq 1
122
122
  end
123
123
  end
@@ -128,17 +128,17 @@ describe Sanctorale do
128
128
  end
129
129
 
130
130
  it 'is never more empty once a record is entered' do
131
- @s.add 1, 17, Celebration.new('S. Antonii, abbatis', Ranks::MEMORIAL_GENERAL)
131
+ @s.add 1, 17, CR::Celebration.new('S. Antonii, abbatis', CR::Ranks::MEMORIAL_GENERAL)
132
132
  expect(@s).not_to be_empty
133
133
  end
134
134
  end
135
135
 
136
136
  describe '#each_day' do
137
- it 'yields each date and corresponding Celebrations' do
138
- cele = Celebration.new('S. Antonii, abbatis', Ranks::MEMORIAL_GENERAL)
137
+ it 'yields each date and corresponding CR::Celebrations' do
138
+ cele = CR::Celebration.new('S. Antonii, abbatis', CR::Ranks::MEMORIAL_GENERAL)
139
139
  @s.add 1, 17, cele
140
140
 
141
- expect {|block| @s.each_day(&block) }.to yield_with_args(AbstractDate.new(1, 17), [cele])
141
+ expect {|block| @s.each_day(&block) }.to yield_with_args(CR::AbstractDate.new(1, 17), [cele])
142
142
  end
143
143
  end
144
144
  end
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe SanctoraleLoader do
3
+ describe CR::SanctoraleLoader do
4
4
 
5
5
  before :each do
6
- @s = Sanctorale.new
7
- @l = SanctoraleLoader.new
6
+ @s = CR::Sanctorale.new
7
+ @l = CR::SanctoraleLoader.new
8
8
  end
9
9
 
10
10
  describe 'data sources' do
@@ -27,17 +27,17 @@ describe SanctoraleLoader do
27
27
  end
28
28
 
29
29
  it 'sets default rank' do
30
- expect(@s.get(1, 3)[0].rank).to eq Ranks::MEMORIAL_OPTIONAL
30
+ expect(@s.get(1, 3)[0].rank).to eq CR::Ranks::MEMORIAL_OPTIONAL
31
31
  end
32
32
 
33
33
  it 'sets default colour - white' do
34
- expect(@s.get(1, 3)[0].colour).to eq Colours::WHITE
34
+ expect(@s.get(1, 3)[0].colour).to eq CR::Colours::WHITE
35
35
  end
36
36
 
37
37
  it 'loads explicit rank if given' do
38
38
  str = '1/25 f : In conversione S. Pauli, apostoli'
39
39
  @l.load_from_string @s, str
40
- expect(@s.get(1, 25)[0].rank).to eq Ranks::FEAST_GENERAL
40
+ expect(@s.get(1, 25)[0].rank).to eq CR::Ranks::FEAST_GENERAL
41
41
  end
42
42
  end
43
43
 
@@ -63,7 +63,7 @@ describe SanctoraleLoader do
63
63
  it 'sets colour if specified' do
64
64
  str = '4/25 f R : S. Marci, evangelistae'
65
65
  @l.load_from_string @s, str
66
- expect(@s.get(4, 25).first.colour).to eq Colours::RED
66
+ expect(@s.get(4, 25).first.colour).to eq CR::Colours::RED
67
67
  end
68
68
  end
69
69
 
@@ -73,7 +73,7 @@ describe SanctoraleLoader do
73
73
  str = '4/23 s1.4 R : S. Georgii, martyris'
74
74
  @l.load_from_string @s, str
75
75
  celeb = @s.get(4, 23).first
76
- expect(celeb.rank).to eq Ranks::SOLEMNITY_PROPER
76
+ expect(celeb.rank).to eq CR::Ranks::SOLEMNITY_PROPER
77
77
  end
78
78
  end
79
79
  end
data/spec/spec_helper.rb CHANGED
@@ -17,6 +17,4 @@ RSpec.configure do |config|
17
17
  end
18
18
 
19
19
  require 'calendarium-romanum'
20
- include CalendariumRomanum
21
- include Ranks
22
- include Colours
20
+ CR = CalendariumRomanum
@@ -1,10 +1,10 @@
1
1
  require_relative 'spec_helper'
2
2
 
3
- describe Temporale do
3
+ describe CR::Temporale do
4
4
 
5
5
  before :all do
6
- @t = @t12 = Temporale.new 2012
7
- @t13 = Temporale.new 2013
6
+ @t = @t12 = described_class.new 2012
7
+ @t13 = described_class.new 2013
8
8
  end
9
9
 
10
10
  describe '.liturgical_year' do
@@ -13,7 +13,7 @@ describe Temporale do
13
13
  [Date.new(2014, 11, 1), 2013],
14
14
  [Date.new(2014, 12, 1), 2014]
15
15
  ].each do |date, year|
16
- Temporale.liturgical_year(date).should eq year
16
+ described_class.liturgical_year(date).should eq year
17
17
  end
18
18
  end
19
19
  end
@@ -122,178 +122,178 @@ describe Temporale do
122
122
 
123
123
  describe '#get' do
124
124
  it 'returns a Celebration' do
125
- expect(@t13.get(8, 12)).to be_a Celebration
125
+ expect(@t13.get(8, 12)).to be_a CR::Celebration
126
126
  end
127
127
 
128
128
  describe 'for' do
129
129
  describe 'ferial' do
130
130
  it 'in Ordinary Time' do
131
131
  c = @t13.get(8, 12)
132
- expect(c.rank).to eq FERIAL
133
- expect(c.color).to eq GREEN
132
+ expect(c.rank).to eq CR::Ranks::FERIAL
133
+ expect(c.color).to eq CR::Colours::GREEN
134
134
  end
135
135
 
136
136
  it 'in Advent' do
137
137
  c = @t13.get(12, 12)
138
- expect(c.rank).to eq FERIAL
139
- expect(c.color).to eq VIOLET
138
+ expect(c.rank).to eq CR::Ranks::FERIAL
139
+ expect(c.color).to eq CR::Colours::VIOLET
140
140
  end
141
141
 
142
142
  it 'in the last week of Advent' do
143
143
  c = @t13.get(12, 23)
144
- expect(c.rank).to eq FERIAL_PRIVILEGED
145
- expect(c.color).to eq VIOLET
144
+ expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
145
+ expect(c.color).to eq CR::Colours::VIOLET
146
146
  end
147
147
 
148
148
  it 'in Christmas time' do
149
149
  c = @t13.get(1, 3)
150
- expect(c.rank).to eq FERIAL
151
- expect(c.color).to eq WHITE
150
+ expect(c.rank).to eq CR::Ranks::FERIAL
151
+ expect(c.color).to eq CR::Colours::WHITE
152
152
  end
153
153
 
154
154
  it 'in Lent' do
155
155
  c = @t13.get(3, 18)
156
- expect(c.rank).to eq FERIAL_PRIVILEGED
157
- expect(c.color).to eq VIOLET
156
+ expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
157
+ expect(c.color).to eq CR::Colours::VIOLET
158
158
  end
159
159
 
160
160
  it 'in Easter Time' do
161
161
  c = @t13.get(5, 5)
162
- expect(c.rank).to eq FERIAL
163
- expect(c.color).to eq WHITE
162
+ expect(c.rank).to eq CR::Ranks::FERIAL
163
+ expect(c.color).to eq CR::Colours::WHITE
164
164
  end
165
165
  end
166
166
 
167
167
  describe 'Sunday' do
168
168
  it 'in Ordinary Time' do
169
169
  c = @t13.get(8, 10)
170
- expect(c.rank).to eq SUNDAY_UNPRIVILEGED
171
- expect(c.color).to eq GREEN
170
+ expect(c.rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
171
+ expect(c.color).to eq CR::Colours::GREEN
172
172
  end
173
173
 
174
174
  it 'in Advent' do
175
175
  c = @t13.get(12, 15)
176
- expect(c.rank).to eq PRIMARY
177
- expect(c.color).to eq VIOLET
176
+ expect(c.rank).to eq CR::Ranks::PRIMARY
177
+ expect(c.color).to eq CR::Colours::VIOLET
178
178
  end
179
179
 
180
180
  it 'in Christmas time' do
181
181
  c = @t13.get(1, 5)
182
- expect(c.rank).to eq SUNDAY_UNPRIVILEGED
183
- expect(c.color).to eq WHITE
182
+ expect(c.rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
183
+ expect(c.color).to eq CR::Colours::WHITE
184
184
  end
185
185
 
186
186
  it 'in Lent' do
187
187
  c = @t13.get(3, 23)
188
- expect(c.rank).to eq PRIMARY
189
- expect(c.color).to eq VIOLET
188
+ expect(c.rank).to eq CR::Ranks::PRIMARY
189
+ expect(c.color).to eq CR::Colours::VIOLET
190
190
  end
191
191
 
192
192
  it 'in Easter Time' do
193
193
  c = @t13.get(5, 11)
194
- expect(c.rank).to eq PRIMARY
195
- expect(c.color).to eq WHITE
194
+ expect(c.rank).to eq CR::Ranks::PRIMARY
195
+ expect(c.color).to eq CR::Colours::WHITE
196
196
  end
197
197
  end
198
198
 
199
199
  describe 'solemnities and their cycles - ' do
200
200
  it 'end of Advent time' do
201
201
  c = @t13.get(12, 17)
202
- expect(c.rank).to eq FERIAL_PRIVILEGED
203
- expect(c.colour).to eq VIOLET
202
+ expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
203
+ expect(c.colour).to eq CR::Colours::VIOLET
204
204
  end
205
205
 
206
206
  it 'Nativity' do
207
207
  c = @t13.get(12, 25)
208
- expect(c.rank).to eq PRIMARY
208
+ expect(c.rank).to eq CR::Ranks::PRIMARY
209
209
  expect(c.title).to eq 'The Nativity of the Lord'
210
- expect(c.colour).to eq WHITE
210
+ expect(c.colour).to eq CR::Colours::WHITE
211
211
  end
212
212
 
213
213
  it 'day in the octave of Nativity' do
214
214
  c = @t13.get(12, 27)
215
- expect(c.rank).to eq FERIAL_PRIVILEGED
216
- expect(c.colour).to eq WHITE
215
+ expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
216
+ expect(c.colour).to eq CR::Colours::WHITE
217
217
  end
218
218
 
219
219
  it 'Holy Family' do
220
220
  c = @t13.get(12, 29)
221
- expect(c.rank).to eq PRIMARY
221
+ expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
222
222
  expect(c.title).to eq 'The Holy Family of Jesus, Mary and Joseph'
223
- expect(c.colour).to eq WHITE
223
+ expect(c.colour).to eq CR::Colours::WHITE
224
224
  end
225
225
 
226
226
  it 'Epiphany' do
227
227
  c = @t13.get(1, 6)
228
- expect(c.rank).to eq PRIMARY
228
+ expect(c.rank).to eq CR::Ranks::PRIMARY
229
229
  expect(c.title).to eq 'The Epiphany of the Lord'
230
- expect(c.colour).to eq WHITE
230
+ expect(c.colour).to eq CR::Colours::WHITE
231
231
  end
232
232
 
233
233
  it 'Baptism of the Lord' do
234
234
  c = @t13.get(1, 12)
235
- expect(c.rank).to eq FEAST_LORD_GENERAL
235
+ expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
236
236
  expect(c.title).to eq 'The Baptism of the Lord'
237
- expect(c.colour).to eq WHITE
237
+ expect(c.colour).to eq CR::Colours::WHITE
238
238
  end
239
239
 
240
240
  it 'Good Friday' do
241
241
  c = @t13.get(4, 18)
242
- expect(c.rank).to eq TRIDUUM
242
+ expect(c.rank).to eq CR::Ranks::TRIDUUM
243
243
  expect(c.title).to eq 'Friday of the Passion of the Lord'
244
244
  end
245
245
 
246
246
  it 'Holy Saturday' do
247
247
  c = @t13.get(4, 19)
248
- expect(c.rank).to eq TRIDUUM
248
+ expect(c.rank).to eq CR::Ranks::TRIDUUM
249
249
  expect(c.title).to eq 'Holy Saturday'
250
- expect(c.colour).to eq VIOLET
250
+ expect(c.colour).to eq CR::Colours::VIOLET
251
251
  end
252
252
 
253
253
  it 'Resurrection' do
254
254
  c = @t13.get(4, 20)
255
- expect(c.rank).to eq TRIDUUM
255
+ expect(c.rank).to eq CR::Ranks::TRIDUUM
256
256
  expect(c.title).to eq 'Easter Sunday of the Resurrection of the Lord'
257
257
  end
258
258
 
259
259
  it 'day in the Easter Octave' do
260
260
  c = @t13.get(4, 22)
261
- expect(c.rank).to eq PRIMARY
261
+ expect(c.rank).to eq CR::Ranks::PRIMARY
262
262
  end
263
263
 
264
264
  it 'Pentecost' do
265
265
  c = @t13.get(6, 8)
266
- expect(c.rank).to eq PRIMARY
266
+ expect(c.rank).to eq CR::Ranks::PRIMARY
267
267
  expect(c.title).to eq 'Pentecost Sunday'
268
- expect(c.colour).to eq RED
268
+ expect(c.colour).to eq CR::Colours::RED
269
269
  end
270
270
 
271
271
  it 'Trinity' do
272
272
  c = @t13.get(6, 15)
273
- expect(c.rank).to eq SOLEMNITY_GENERAL
273
+ expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
274
274
  expect(c.title).to eq 'The Most Holy Trinity'
275
- expect(c.colour).to eq WHITE
275
+ expect(c.colour).to eq CR::Colours::WHITE
276
276
  end
277
277
 
278
278
  it 'Body of Christ' do
279
279
  c = @t13.get(6, 19)
280
- expect(c.rank).to eq SOLEMNITY_GENERAL
280
+ expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
281
281
  expect(c.title).to eq 'The Most Holy Body and Blood of Christ'
282
- expect(c.colour).to eq WHITE
282
+ expect(c.colour).to eq CR::Colours::WHITE
283
283
  end
284
284
 
285
285
  it 'Sacred Heart' do
286
286
  c = @t13.get(6, 27)
287
- expect(c.rank).to eq SOLEMNITY_GENERAL
287
+ expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
288
288
  expect(c.title).to eq 'The Most Sacred Heart of Jesus'
289
- expect(c.colour).to eq WHITE
289
+ expect(c.colour).to eq CR::Colours::WHITE
290
290
  end
291
291
 
292
292
  it 'Christ the King' do
293
293
  c = @t13.get(11, 23)
294
- expect(c.rank).to eq SOLEMNITY_GENERAL
294
+ expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
295
295
  expect(c.title).to eq 'Our Lord Jesus Christ, King of the Universe'
296
- expect(c.colour).to eq WHITE
296
+ expect(c.colour).to eq CR::Colours::WHITE
297
297
  end
298
298
  end
299
299
  end
@@ -301,11 +301,11 @@ describe Temporale do
301
301
 
302
302
  describe 'initialized without a year' do
303
303
  before :each do
304
- @tny = Temporale.new
304
+ @tny = described_class.new
305
305
  end
306
306
 
307
307
  it 'is possible to initialize a Temporale without a year' do
308
- expect { Temporale.new }.not_to raise_exception
308
+ expect { described_class.new }.not_to raise_exception
309
309
  end
310
310
 
311
311
  it 'crashes when a date is requested without year' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendarium-romanum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Pavlík
@@ -24,161 +24,8 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.14'
27
- description: |
28
- # calendarium-romanum
29
-
30
- [![Build Status](https://travis-ci.org/igneus/calendarium-romanum.svg?branch=master)](https://travis-ci.org/igneus/calendarium-romanum)
31
-
32
- [API documentation](http://www.rubydoc.info/github/igneus/calendarium-romanum/master)
33
-
34
- Ruby gem for
35
- calendar computations according to the Roman Catholic liturgical
36
- calendar as instituted by
37
- MP Mysterii Paschalis of Paul VI. ([AAS 61 (1969)](http://www.vatican.va/archive/aas/documents/AAS-61-1969-ocr.pdf), pp. 222-226).
38
- The rules are defined in General Norms for the Liturgical Year
39
- and the Calendar
40
- ([English translation](https://www.ewtn.com/library/CURIA/CDWLITYR.HTM)).
41
-
42
- ## Features
43
-
44
- - [x] liturgical season
45
- - [x] Sundays, temporale feasts
46
- - [x] sanctorale calendars: data format, example data files, their loading
47
- - [x] resolution of precedence of concurrent celebrations
48
- - [x] octave days
49
- - [ ] commemorations in the privileged seasons where memorials are suppressed
50
- - [x] transfer of suppressed solemnities
51
- - [ ] additional temporale feasts (Christ the Eternal Priest and similar)
52
- - [ ] optional transfer of important solemnities on a nearby Sunday
53
-
54
- ## Credits
55
-
56
- includes an important bit of code from the
57
- [easter](https://github.com/jrobertson/easter) gem
58
- by James Robertson
59
-
60
- ## License
61
-
62
- freely choose between GNU/LGPL 3 and MIT
63
-
64
- ## Basic Usage
65
-
66
- For more self-explaining, commented and copy-pastable
67
- examples see the [examples directory](./examples/).
68
-
69
- All the examples below expect that you first required the gem:
70
-
71
- ```ruby
72
- require 'calendarium-romanum'
73
- ```
74
-
75
- ### 1. What liturgical season is it today?
76
-
77
- ```ruby
78
- calendar = CalendariumRomanum::Calendar.for_day(Date.today)
79
- day = calendar.day(Date.today)
80
- day.season # => :ordinary
81
- ```
82
-
83
- `Day#season` returns a `Symbol` representing the current liturgical
84
- season.
85
-
86
- ### 2. What liturgical day is it today?
87
-
88
- `Day` has several other properties.
89
- `Day#celebrations` returns an `Array` of `Celebration`s
90
- that occur on the given day. Usually the `Array` has a single
91
- element, but in case of optional celebrations (several optional
92
- memorials occurring on a ferial) it may have two or more.
93
-
94
- ```ruby
95
- day.celebrations # => [#<CalendariumRomanum::Celebration:0x00000001741c78 @title="", @rank=#<struct CalendariumRomanum::Rank priority=3.13, desc="Unprivileged ferials", short_desc="ferial">, @colour=:green>]
96
- ```
97
-
98
- In this case the single `Celebration` available is a ferial,
99
- described by it's title (empty in this case), rank and liturgical
100
- colour.
101
-
102
- ### 3. But does it take feasts of saints in account?
103
-
104
- Actually, no. Not yet. We need to load some calendar data first:
105
-
106
- ```ruby
107
- sanctorale = CalendariumRomanum::Sanctorale.new
108
- loader = CalendariumRomanum::SanctoraleLoader.new
109
- loader.load_from_file sanctorale, 'data/universal-en.txt' # insert path to your data file
110
- calendar = CalendariumRomanum::Calendar.for_day(Date.today, sanctorale)
111
- day = calendar.day(Date.new(2016, 8, 19))
112
- day.celebrations # => [#<CalendariumRomanum::Celebration:0x000000016ed330 @title="", @rank=#<struct CalendariumRomanum::Rank priority=3.13, desc="Unprivileged ferials", short_desc="ferial">, @colour=:green>, #<CalendariumRomanum::Celebration:0x00000001715790 @title="Saint John Eudes, priest", @rank=#<struct CalendariumRomanum::Rank priority=3.12, desc="Optional memorials", short_desc="optional memorial">, @colour=:white>]
113
- ```
114
-
115
- Unless a sanctorale is loaded, `Calendar` only counts with
116
- temporale feasts, Sundays and ferials.
117
-
118
- ## Sanctorale Data
119
-
120
- ### Use prepared data or create your own
121
-
122
- The gem expects data files following a custom format -
123
- see README in the [data](/data) directory for it's description.
124
- The same directory contains a bunch of example data files.
125
-
126
- `universal-en.txt` and `universal-la.txt` are data of the General
127
- Roman Calendar in English and Latin.
128
-
129
- The other files, when layered properly, can be used to assemble
130
- proper calendar of any diocese in the Czech Republic.
131
- They were made for the author's practical purposes, but also
132
- as an example of organization of structured calendar data.
133
- Data for any other country could be prepared similarly.
134
-
135
- There are three layers:
136
-
137
- 1. country
138
- 2. ecclesiastical province
139
- 3. diocese
140
-
141
- The tree of correct combinations looks like this:
142
-
143
- * `czech-cs.txt`
144
- * `czech-cechy-cs.txt`
145
- * `czech-praha-cs.txt`
146
- * `czech-hradec-cs.txt`
147
- * `czech-litomerice-cs.txt`
148
- * `czech-budejovice-cs.txt`
149
- * `czech-plzen-cs.txt`
150
- * `czech-morava-cs.txt`
151
- * `czech-olomouc-cs.txt`
152
- * `czech-brno-cs.txt`
153
- * `czech-ostrava-cs.txt`
154
-
155
- ### Implement custom loading strategy
156
-
157
- In case you already have sanctorale data in another format,
158
- it might be better suited for you to implement your own loading
159
- routine instead of migrating them to our custom format.
160
- `SanctoraleLoader` is the class to look into for inspiration.
161
-
162
- The important bit is that for each celebration you
163
- build a `Celebration` instance and push it in a `Sanctorale`
164
- instance by a call to `Sanctorale#add`, which receives a month,
165
- a day (as integers) and a `Celebration`:
166
-
167
- ```ruby
168
- include CalendariumRomanum
169
- sanctorale = Sanctorale.new
170
- celebration = Celebration.new('Saint John Eudes, priest', Ranks::MEMORIAL_OPTIONAL, Colours::WHITE)
171
- sanctorale.add 8, 19, celebration
172
- calendar = Calendar.for_day(Date.today, sanctorale)
173
- ```
174
-
175
- Now our `Sanctorale` knows one feast and the `Calendar` resolves
176
- it correctly:
177
-
178
- ```ruby
179
- day = calendar.day(Date.new(2016, 8, 19))
180
- day.celebrations # => [#<CalendariumRomanum::Celebration:0x000000010deea8 @title="", @rank=#<struct CalendariumRomanum::Rank priority=3.13, desc="Unprivileged ferials", short_desc="ferial">, @colour=:green>, #<CalendariumRomanum::Celebration:0x000000010fec08 @title="Saint John Eudes, priest", @rank=#<struct CalendariumRomanum::Rank priority=3.12, desc="Optional memorials", short_desc="optional memorial">, @colour=:white>]
181
- ```
27
+ description: calendar computations according to the Roman Catholic liturgical calendar
28
+ as instituted by MP Mysterii Paschalis of Paul VI (1969).
182
29
  email: jkb.pavlik@gmail.com
183
30
  executables: []
184
31
  extensions: []
@@ -194,6 +41,7 @@ files:
194
41
  - lib/calendarium-romanum/enums.rb
195
42
  - lib/calendarium-romanum/sanctoraleloader.rb
196
43
  - lib/calendarium-romanum/abstract_date.rb
44
+ - lib/calendarium-romanum/version.rb
197
45
  - lib/calendarium-romanum/temporale.rb
198
46
  - spec/calendar_spec.rb
199
47
  - spec/date_spec.rb