calendarium-romanum 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.rubocop.yml +9 -6
  4. data/.travis.yml +2 -1
  5. data/Appraisals +67 -0
  6. data/CHANGELOG.md +57 -0
  7. data/Gemfile +1 -0
  8. data/Gemfile.lock +21 -12
  9. data/README.md +13 -10
  10. data/Rakefile +13 -2
  11. data/calendarium-romanum.gemspec +2 -2
  12. data/config/locales/pt.yml +94 -0
  13. data/data/czech-cs.txt +5 -2
  14. data/data/universal-1969-la.txt +1 -1
  15. data/data/universal-en.txt +5 -2
  16. data/data/universal-es.txt +7 -4
  17. data/data/universal-fr.txt +5 -2
  18. data/data/universal-it.txt +6 -3
  19. data/data/universal-la.txt +102 -99
  20. data/data/universal-pt.txt +248 -0
  21. data/lib/calendarium-romanum.rb +3 -0
  22. data/lib/calendarium-romanum/calendar.rb +13 -11
  23. data/lib/calendarium-romanum/cli.rb +32 -3
  24. data/lib/calendarium-romanum/cli/comparator.rb +22 -2
  25. data/lib/calendarium-romanum/data.rb +2 -0
  26. data/lib/calendarium-romanum/enum.rb +2 -4
  27. data/lib/calendarium-romanum/enums.rb +5 -1
  28. data/lib/calendarium-romanum/sanctorale.rb +51 -1
  29. data/lib/calendarium-romanum/sanctorale_factory.rb +2 -2
  30. data/lib/calendarium-romanum/sanctorale_writer.rb +6 -1
  31. data/lib/calendarium-romanum/temporale.rb +50 -21
  32. data/lib/calendarium-romanum/temporale/date_helper.rb +85 -0
  33. data/lib/calendarium-romanum/temporale/dates.rb +36 -111
  34. data/lib/calendarium-romanum/temporale/extensions/dedication_before_all_saints.rb +1 -1
  35. data/lib/calendarium-romanum/transfers.rb +29 -14
  36. data/lib/calendarium-romanum/version.rb +2 -2
  37. data/liturgical_law/2020_dubia_de_calendario_2022.md +100 -0
  38. metadata +15 -10
@@ -46,7 +46,7 @@ module CalendariumRomanum
46
46
  # @param year [Integer] liturgical year
47
47
  # @return [Date]
48
48
  def self.dedication(year)
49
- Dates.sunday_before(Date.new(year + 1, 11, 1))
49
+ DateHelper.sunday_before(Date.new(year + 1, 11, 1))
50
50
  end
51
51
 
52
52
  def initialize(title: DEFAULT_TITLE, symbol: DEFAULT_SYMBOL)
@@ -1,6 +1,6 @@
1
1
  module CalendariumRomanum
2
2
 
3
- # Internal {Calendar} component.
3
+ # {Calendar} component.
4
4
  # Resolves transfers of conflicting solemnities.
5
5
  #
6
6
  # For any day {Temporale} has a {Celebration}.
@@ -12,20 +12,31 @@ module CalendariumRomanum
12
12
  # one is celebrated on the given day and the less lucky one
13
13
  # must be transferred to another day.
14
14
  # However, not all days are valid as targets of solemnity transfer.
15
- #
16
- # @api private
15
+ # This class handles the logic of transferring impeded solemnities
16
+ # to suitable dates.
17
17
  class Transfers
18
18
  # @param temporale [Temporale]
19
19
  # @param sanctorale [Sanctorale]
20
+ # @api private
20
21
  def initialize(temporale, sanctorale)
21
22
  @temporale = temporale
22
23
  @sanctorale = sanctorale
23
24
  end
24
25
 
26
+ # Resolves any conflict between temporale and sanctorale solemnities
27
+ # by deciding which of the conflicting solemnities is to take the original
28
+ # date, which is to be transferred, and specifying a date for both of them
29
+ # in the resulting Hash.
30
+ #
31
+ # @param temporale [Temporale]
32
+ # @param sanctorale [Sanctorale]
33
+ # @return [Hash<Date=>Celebration>]
25
34
  def self.call(temporale, sanctorale)
26
35
  new(temporale, sanctorale).call
27
36
  end
28
37
 
38
+ # @return [Hash<Date=>Celebration>]
39
+ # @api private
29
40
  def call
30
41
  @transferred = {}
31
42
 
@@ -37,10 +48,10 @@ module CalendariumRomanum
37
48
  tc = @temporale[date]
38
49
  next unless tc.solemnity?
39
50
 
40
- sc = @sanctorale[date]
41
- next unless sc.size == 1 && sc.first.solemnity?
51
+ sc = @sanctorale[date].first
52
+ next unless sc && sc.solemnity?
42
53
 
43
- loser = [tc, sc.first].sort_by(&:rank).first
54
+ loser, winner = [sc, tc].sort_by(&:rank)
44
55
 
45
56
  transfer_to =
46
57
  if loser.symbol == :annunciation && in_holy_week?(date)
@@ -50,6 +61,8 @@ module CalendariumRomanum
50
61
  free_day_closest_to(date)
51
62
  end
52
63
  @transferred[transfer_to] = loser
64
+ # primary celebrations have noone to be beaten by, no need to harden their dates
65
+ @transferred[date] = winner unless winner.rank == Ranks::PRIMARY
53
66
  end
54
67
 
55
68
  @transferred
@@ -69,17 +82,19 @@ module CalendariumRomanum
69
82
 
70
83
  # Converts an AbstractDate to a Date in the given
71
84
  # liturgical year.
72
- # It isn't guaranteed to work well (and probably doesn't work well)
73
- # for the grey zone of dates between earliest and latest
74
- # possible date of the first Advent Sunday, but that's no problem
75
- # as long as there are no sanctorale solemnities in this
76
- # date range.
77
85
  def concretize_abstract_date(abstract_date)
78
- d = abstract_date.concretize(@temporale.year + 1)
86
+ year = @temporale.year
87
+ d = abstract_date.concretize(year + 1)
88
+ d_prev = abstract_date.concretize(year)
89
+
79
90
  if @temporale.date_range.include? d
91
+ if @temporale.date_range.include?(d_prev)
92
+ raise RuntimeError.new("Ambiguous case, #{abstract_date} twice in liturgical year #{year}")
93
+ end
94
+
80
95
  d
81
96
  else
82
- abstract_date.concretize(@temporale.year)
97
+ d_prev
83
98
  end
84
99
  end
85
100
 
@@ -88,7 +103,7 @@ module CalendariumRomanum
88
103
  end
89
104
 
90
105
  def dates_around(date)
91
- return to_enum(:dates_around, date) unless block_given?
106
+ return to_enum(__method__, date) unless block_given?
92
107
 
93
108
  1.upto(100) do |i|
94
109
  yield date + i
@@ -1,7 +1,7 @@
1
1
  require 'date'
2
2
 
3
3
  module CalendariumRomanum
4
- VERSION = '0.8.0'.freeze
4
+ VERSION = '0.9.0'.freeze
5
5
 
6
- RELEASE_DATE = Date.new(2020, 11, 25).freeze
6
+ RELEASE_DATE = Date.new(2021, 4, 11).freeze
7
7
  end
@@ -0,0 +1,100 @@
1
+ ---
2
+ title: Responsum ad dubia de calendario liturgico exarando pro anno 2022
3
+ source: http://www.cultodivino.va/content/cultodivino/it/documenti/responsa-ad-dubia/2020/de-calendario-liturgico-2022.html
4
+ ---
5
+
6
+ # RESPONSUM AD DUBIA DE CALENDARIO LITURGICO EXARANDO PRO ANNO 2022
7
+
8
+ Redactores nonnulli "Ordinis Missae celebrandae et Officii Divini persolvendi" dubia proposuerunt
9
+ de Calendario liturgico pro venturo anno 2022 exarando, cum sollemnitas quaedam die sabbati aut feria
10
+ secunda occurrit.
11
+
12
+ Attento numero 60 ["Normarum universalium de anno liturgico et de Calendario"](./2002_normae_universales.md),
13
+ infrascriptarum celebrationum ordo sequenti modo erit disponendus:
14
+
15
+ a) Sollemnitas Sanctae Dei Genetricis Mariae, die 1 ianuarii, sabbato.
16
+ Dominica II Post Nativitatem, die 2 ianuarii.
17
+
18
+ - Die 1 ianuarii II Vesperae et Missa vespertina sollemnitatis Sanctae Dei Genetricis Mariae celebrentur.
19
+
20
+ ```ruby
21
+ calendar = CR::Calendar.new 2021, CR::Data::GENERAL_ROMAN_LATIN.load, vespers: true
22
+
23
+ date = Date.new(2022, 1, 1)
24
+ expect(date).to be_saturday
25
+
26
+ day = calendar[date]
27
+ expect(day.celebrations[0].symbol).to be :mother_of_god
28
+ expect(day.vespers).to be nil
29
+
30
+ expect(calendar[Date.new(2022, 1, 2)].celebrations[0].rank)
31
+ .to be CR::Ranks::SUNDAY_UNPRIVILEGED
32
+ ```
33
+
34
+ b) Sollemnitas S. Ioseph Sponsi Beatae Mariae Virginis, die 19 martii, sabbato.
35
+ Dominica III in Quadragesima, die 20 martii.
36
+
37
+ - Die 19 martii I Vesperae et Missa vespertina Dominicae III in Quadragesima celebrentur.
38
+
39
+ ```ruby
40
+ calendar = CR::Calendar.new 2021, CR::Data::GENERAL_ROMAN_LATIN.load, vespers: true
41
+
42
+ date = Date.new(2022, 3, 19)
43
+ expect(date).to be_saturday
44
+
45
+ I18n.with_locale(:la) do
46
+ day = calendar[date]
47
+ expect(day.celebrations[0].symbol).to be :joseph
48
+ expect(day.vespers.title).to eq 'Dominica III Quadragesimae'
49
+ end
50
+ ```
51
+
52
+ c) Sollemnitas Nativitatis S. Ioanni Baptistae et sollemnitas Sacratissimi Cordis Iesu, eadem die 24 iunii
53
+ coincidentes.
54
+
55
+ - Die 24 iunii, feria VI: sollemnitas Sacratissimi Cordis Iesu celebretur.
56
+ Sollemnitas Nativitatis S. Ioannis Baptistae ad diem 23 iunii, feriam V, transferatur,
57
+ II Vesperae omittantur. I Vesperae sollemnitatis Sacratissimi Cordis Iesu celebrentur.
58
+
59
+ ```ruby
60
+ pending 'ad hoc solution beyond the regular calendar rules, not supported in this version of calendarium-romanum'
61
+
62
+ calendar = CR::Calendar.new 2021, CR::Data::GENERAL_ROMAN_LATIN.load, vespers: true
63
+
64
+ i23 = Date.new(2022, 6, 23)
65
+ i24 = i23 + 1
66
+
67
+ expect(i24).to be_friday
68
+
69
+ expect(calendar[i24].celebrations[0].symbol).to be :sacred_heart
70
+
71
+ day = calendar[i23]
72
+ expect(day.celebrations[0].symbol).to be :baptist_birth
73
+ expect(day.vespers.symbol).to be :sacred_heart
74
+ ```
75
+
76
+ Ubi vero S. Ioannes Baptista patronus sit nationis vel dioecesis vel civitatis aut
77
+ communitatis religiosae, sollemnitas Nativitatis S. Ioannis Baptistae die 24 iunii,
78
+ feria VI, celebretur; sollemnitas autem Sacratissimi Cordis Iesu ad diem 23 iunii,
79
+ feriam V transferatur, usque ad horam Nonam inclusive.
80
+
81
+ ```ruby
82
+ skip 'there is currently no pretty way how to model this scenario using calendarium-romanum -
83
+ significant customizations of core functionalities would be required'
84
+ ```
85
+
86
+ d) Dominica XX Temporis "per annum", die 14 augusti.
87
+ Sollemnitas Assumptionis Beatae Mariae Virginis, die 15 augusti, feria II.
88
+
89
+ - Die 14 augusti I Vesperae et Missa in Vigilia sollemnitatis Assumptionis Beatae Mariae Virginis
90
+ celebrentur.
91
+
92
+ ```ruby
93
+ calendar = CR::Calendar.new 2021, CR::Data::GENERAL_ROMAN_LATIN.load, vespers: true
94
+
95
+ date = Date.new(2022, 8, 14)
96
+ expect(date).to be_sunday
97
+ expect(calendar[date].vespers.symbol).to be :assumption
98
+ ```
99
+
100
+ Ex aedibus Congregationis de Cultu Divino et Disciplina Sacramentorum, die 11 mensis maii 2020.
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendarium-romanum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
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: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2021-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.18'
19
+ version: '0.15'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.18'
26
+ version: '0.15'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: i18n
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: '0.7'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.6'
40
+ version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: roman-numerals
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +95,7 @@ files:
95
95
  - ".rubocop.yml"
96
96
  - ".travis.yml"
97
97
  - ".yardopts"
98
+ - Appraisals
98
99
  - CHANGELOG.md
99
100
  - Gemfile
100
101
  - Gemfile.lock
@@ -108,6 +109,7 @@ files:
108
109
  - config/locales/fr.yml
109
110
  - config/locales/it.yml
110
111
  - config/locales/la.yml
112
+ - config/locales/pt.yml
111
113
  - data/README.md
112
114
  - data/czech-brno-cs.txt
113
115
  - data/czech-budejovice-cs.txt
@@ -127,6 +129,7 @@ files:
127
129
  - data/universal-fr.txt
128
130
  - data/universal-it.txt
129
131
  - data/universal-la.txt
132
+ - data/universal-pt.txt
130
133
  - doc/data_readme.md
131
134
  - doc/images/class_diagram.png
132
135
  - doc/images/class_diagram.puml
@@ -157,6 +160,7 @@ files:
157
160
  - lib/calendarium-romanum/sanctorale_writer.rb
158
161
  - lib/calendarium-romanum/temporale.rb
159
162
  - lib/calendarium-romanum/temporale/celebration_factory.rb
163
+ - lib/calendarium-romanum/temporale/date_helper.rb
160
164
  - lib/calendarium-romanum/temporale/dates.rb
161
165
  - lib/calendarium-romanum/temporale/easter_table.rb
162
166
  - lib/calendarium-romanum/temporale/extensions.rb
@@ -172,6 +176,7 @@ files:
172
176
  - liturgical_law/2002_normae_universales.md
173
177
  - liturgical_law/2006_notification.md
174
178
  - liturgical_law/2012_declarationes.md
179
+ - liturgical_law/2020_dubia_de_calendario_2022.md
175
180
  - liturgical_law/README.md
176
181
  homepage: http://github.com/igneus/calendarium-romanum
177
182
  licenses: