calendarium-romanum 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/calendariumrom +65 -0
- data/lib/calendarium-romanum.rb +13 -0
- data/lib/calendarium-romanum/abstract_date.rb +59 -0
- data/lib/calendarium-romanum/calendar.rb +130 -0
- data/lib/calendarium-romanum/day.rb +59 -0
- data/lib/calendarium-romanum/enums.rb +84 -0
- data/lib/calendarium-romanum/sanctorale.rb +80 -0
- data/lib/calendarium-romanum/sanctoraleloader.rb +100 -0
- data/lib/calendarium-romanum/temporale.rb +382 -0
- data/lib/calendarium-romanum/transfers.rb +44 -0
- data/lib/calendarium-romanum/util.rb +40 -0
- data/spec/abstract_date_spec.rb +45 -0
- data/spec/calendar_spec.rb +217 -0
- data/spec/date_spec.rb +10 -0
- data/spec/rank_spec.rb +30 -0
- data/spec/sanctorale_spec.rb +144 -0
- data/spec/sanctoraleloader_spec.rb +142 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/temporale_spec.rb +342 -0
- metadata +231 -0
metadata
ADDED
@@ -0,0 +1,231 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: calendarium-romanum
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jakub Pavlík
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.14'
|
27
|
+
description: |
|
28
|
+
# calendarium-romanum
|
29
|
+
|
30
|
+
[](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
|
+
```
|
182
|
+
email: jkb.pavlik@gmail.com
|
183
|
+
executables: []
|
184
|
+
extensions: []
|
185
|
+
extra_rdoc_files: []
|
186
|
+
files:
|
187
|
+
- bin/calendariumrom
|
188
|
+
- lib/calendarium-romanum.rb
|
189
|
+
- lib/calendarium-romanum/day.rb
|
190
|
+
- lib/calendarium-romanum/calendar.rb
|
191
|
+
- lib/calendarium-romanum/util.rb
|
192
|
+
- lib/calendarium-romanum/sanctorale.rb
|
193
|
+
- lib/calendarium-romanum/transfers.rb
|
194
|
+
- lib/calendarium-romanum/enums.rb
|
195
|
+
- lib/calendarium-romanum/sanctoraleloader.rb
|
196
|
+
- lib/calendarium-romanum/abstract_date.rb
|
197
|
+
- lib/calendarium-romanum/temporale.rb
|
198
|
+
- spec/calendar_spec.rb
|
199
|
+
- spec/date_spec.rb
|
200
|
+
- spec/temporale_spec.rb
|
201
|
+
- spec/spec_helper.rb
|
202
|
+
- spec/abstract_date_spec.rb
|
203
|
+
- spec/rank_spec.rb
|
204
|
+
- spec/sanctoraleloader_spec.rb
|
205
|
+
- spec/sanctorale_spec.rb
|
206
|
+
homepage: http://github.com/igneus/calendarium-romanum
|
207
|
+
licenses:
|
208
|
+
- LGPL-3.0
|
209
|
+
- MIT
|
210
|
+
metadata: {}
|
211
|
+
post_install_message:
|
212
|
+
rdoc_options: []
|
213
|
+
require_paths:
|
214
|
+
- lib
|
215
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- - ">="
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0'
|
220
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
|
+
requirements:
|
222
|
+
- - ">="
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: '0'
|
225
|
+
requirements: []
|
226
|
+
rubyforge_project:
|
227
|
+
rubygems_version: 2.1.11
|
228
|
+
signing_key:
|
229
|
+
specification_version: 4
|
230
|
+
summary: Roman Catholic liturgical calendar computations
|
231
|
+
test_files: []
|