calendarium-romanum 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/bin/calendariumrom +1 -1
  3. data/config/locales/cs.yml +1 -0
  4. data/config/locales/en.yml +1 -0
  5. data/config/locales/fr.yml +1 -0
  6. data/config/locales/it.yml +1 -0
  7. data/config/locales/la.yml +1 -0
  8. data/data/czech-cs.txt +2 -1
  9. data/data/universal-la.txt +2 -0
  10. data/lib/calendarium-romanum.rb +24 -22
  11. data/lib/calendarium-romanum/calendar.rb +66 -16
  12. data/lib/calendarium-romanum/cli.rb +84 -52
  13. data/lib/calendarium-romanum/data.rb +12 -12
  14. data/lib/calendarium-romanum/day.rb +35 -14
  15. data/lib/calendarium-romanum/enum.rb +2 -4
  16. data/lib/calendarium-romanum/enums.rb +1 -1
  17. data/lib/calendarium-romanum/errors.rb +4 -0
  18. data/lib/calendarium-romanum/ordinalizer.rb +13 -1
  19. data/lib/calendarium-romanum/rank.rb +5 -5
  20. data/lib/calendarium-romanum/sanctorale.rb +2 -2
  21. data/lib/calendarium-romanum/sanctoraleloader.rb +31 -24
  22. data/lib/calendarium-romanum/temporale.rb +64 -83
  23. data/lib/calendarium-romanum/temporale/celebration_factory.rb +48 -0
  24. data/lib/calendarium-romanum/temporale/dates.rb +14 -14
  25. data/lib/calendarium-romanum/util.rb +22 -1
  26. data/lib/calendarium-romanum/version.rb +4 -1
  27. data/spec/calendar_spec.rb +232 -3
  28. data/spec/celebration_factory_spec.rb +16 -0
  29. data/spec/celebration_spec.rb +20 -0
  30. data/spec/cli_spec.rb +140 -11
  31. data/spec/date_parser_spec.rb +68 -0
  32. data/spec/date_spec.rb +8 -8
  33. data/spec/day_spec.rb +57 -8
  34. data/spec/i18n_spec.rb +0 -1
  35. data/spec/ordinalizer_spec.rb +29 -15
  36. data/spec/readme_spec.rb +4 -0
  37. data/spec/sanctorale_spec.rb +3 -3
  38. data/spec/sanctoraleloader_spec.rb +16 -11
  39. data/spec/spec_helper.rb +11 -0
  40. data/spec/temporale_spec.rb +56 -3
  41. metadata +6 -2
@@ -25,18 +25,18 @@ module CalendariumRomanum
25
25
  CZECH = SanctoraleFile.new('czech-cs.txt')
26
26
  ] \
27
27
  +
28
- %w(
29
- czech-brno-cs.txt
30
- czech-budejovice-cs.txt
31
- czech-cechy-cs.txt
32
- czech-hradec-cs.txt
33
- czech-litomerice-cs.txt
34
- czech-morava-cs.txt
35
- czech-olomouc-cs.txt
36
- czech-ostrava-cs.txt
37
- czech-plzen-cs.txt
38
- czech-praha-cs.txt
39
- ).collect {|basename| SanctoraleFile.new(basename) }
28
+ %w(
29
+ czech-brno-cs.txt
30
+ czech-budejovice-cs.txt
31
+ czech-cechy-cs.txt
32
+ czech-hradec-cs.txt
33
+ czech-litomerice-cs.txt
34
+ czech-morava-cs.txt
35
+ czech-olomouc-cs.txt
36
+ czech-ostrava-cs.txt
37
+ czech-plzen-cs.txt
38
+ czech-praha-cs.txt
39
+ ).collect {|basename| SanctoraleFile.new(basename) }
40
40
  end
41
41
  end
42
42
  end
@@ -4,16 +4,12 @@ module CalendariumRomanum
4
4
 
5
5
  # information on one particular day of the liturgical year
6
6
  class Day
7
- def initialize(args={})
8
- %i(date season season_week celebrations).each do |a|
9
- if args.include? a
10
- instance_variable_set "@#{a}", args.delete(a)
11
- end
12
- end
13
-
14
- unless args.empty?
15
- raise ArgumentError.new "Unexpected arguments #{args.keys.join(', ')}"
16
- end
7
+ def initialize(date: nil, season: nil, season_week: nil, celebrations: nil, vespers: nil)
8
+ @date = date
9
+ @season = season
10
+ @season_week = season_week
11
+ @celebrations = celebrations ? celebrations.dup : []
12
+ @vespers = vespers
17
13
  end
18
14
 
19
15
  attr_reader :date
@@ -22,7 +18,7 @@ module CalendariumRomanum
22
18
  date.wday
23
19
  end
24
20
 
25
- # one of the Seasons (Symbol)
21
+ # one of the Seasons
26
22
  attr_reader :season
27
23
 
28
24
  # week of the season (Integer)
@@ -31,12 +27,25 @@ module CalendariumRomanum
31
27
  # an Array of Celebrations, possibly empty
32
28
  attr_reader :celebrations
33
29
 
30
+ # nil or Celebration from which first Vespers are celebrated
31
+ # instead of Vespers of the day's other Celebrations.
32
+ # Please note that Calendar by default *doesn't* populate
33
+ # Vespers, - it's an opt-in feature.
34
+ attr_reader :vespers
35
+
34
36
  def ==(other)
35
37
  self.class == other.class &&
36
38
  date == other.date &&
37
39
  season == other.season &&
38
40
  season_week == other.season_week &&
39
- celebrations == other.celebrations
41
+ celebrations == other.celebrations &&
42
+ vespers == other.vespers
43
+ end
44
+
45
+ # Are the day's Vespers suppressed in favour of first Vespers
46
+ # of a Sunday or solemnity?
47
+ def vespers_from_following?
48
+ !vespers.nil?
40
49
  end
41
50
  end
42
51
 
@@ -47,10 +56,11 @@ module CalendariumRomanum
47
56
  class Celebration
48
57
  extend Forwardable
49
58
 
50
- def initialize(title='', rank=Ranks::FERIAL, colour=Colours::GREEN)
59
+ def initialize(title = '', rank = Ranks::FERIAL, colour = Colours::GREEN, symbol = nil)
51
60
  @title = title
52
61
  @rank = rank
53
62
  @colour = colour
63
+ @symbol = symbol
54
64
  end
55
65
 
56
66
  attr_reader :rank
@@ -65,7 +75,9 @@ module CalendariumRomanum
65
75
  end
66
76
 
67
77
  attr_reader :colour
68
- alias_method :color, :colour
78
+ alias color colour
79
+
80
+ attr_reader :symbol
69
81
 
70
82
  def ==(other)
71
83
  self.class == other.class &&
@@ -73,5 +85,14 @@ module CalendariumRomanum
73
85
  rank == other.rank &&
74
86
  colour == other.colour
75
87
  end
88
+
89
+ def change(title: nil, rank: nil, colour: nil, color: nil, symbol: nil)
90
+ self.class.new(
91
+ title || self.title,
92
+ rank || self.rank,
93
+ colour || color || self.colour,
94
+ symbol || self.symbol
95
+ )
96
+ end
76
97
  end
77
98
  end
@@ -6,7 +6,7 @@ module CalendariumRomanum
6
6
  class << self
7
7
  extend Forwardable
8
8
 
9
- def values(index_by: nil, &blk)
9
+ def values(index_by: nil)
10
10
  defined?(@indexed) && raise(RuntimeError.new('initialized repeatedly'))
11
11
 
12
12
  @indexed = {}
@@ -22,9 +22,7 @@ module CalendariumRomanum
22
22
  @indexed.freeze
23
23
  end
24
24
 
25
- def all
26
- @all
27
- end
25
+ attr_reader :all
28
26
 
29
27
  def_delegators :@all, :each
30
28
  def_delegators :@indexed, :[]
@@ -54,7 +54,7 @@ module CalendariumRomanum
54
54
  end
55
55
  end
56
56
 
57
- LECTIONARY_CYCLES = [:A, :B, :C]
57
+ LECTIONARY_CYCLES = [:A, :B, :C].freeze
58
58
 
59
59
  # ranks of celebrations
60
60
  class Ranks < Enum
@@ -0,0 +1,4 @@
1
+ module CalendariumRomanum
2
+ # attempt to load invalid calendar data
3
+ class InvalidDataError < RuntimeError; end
4
+ end
@@ -12,7 +12,8 @@ module CalendariumRomanum
12
12
  "#{number}."
13
13
  when :en
14
14
  english_ordinal(number)
15
- # when :it # TODO
15
+ when :fr
16
+ french_ordinal(number)
16
17
  when :la, :it
17
18
  RomanNumerals.to_roman number
18
19
  else
@@ -20,6 +21,8 @@ module CalendariumRomanum
20
21
  end
21
22
  end
22
23
 
24
+ private
25
+
23
26
  def english_ordinal(number)
24
27
  modulo = number % 10
25
28
  modulo = 9 if number / 10 == 1
@@ -35,6 +38,15 @@ module CalendariumRomanum
35
38
  "#{number}th"
36
39
  end
37
40
  end
41
+
42
+ def french_ordinal(number)
43
+ case number
44
+ when 1
45
+ '1er'
46
+ else
47
+ "#{number}ème"
48
+ end
49
+ end
38
50
  end
39
51
  end
40
52
  end
@@ -2,27 +2,27 @@ module CalendariumRomanum
2
2
  class Rank
3
3
  include Comparable
4
4
 
5
- def initialize(priority=nil, desc=nil, short_desc=nil)
5
+ def initialize(priority = nil, desc = nil, short_desc = nil)
6
6
  @priority = priority
7
7
  @desc = desc
8
8
  @short_desc = short_desc
9
9
  end
10
10
 
11
11
  attr_reader :priority
12
- alias_method :to_f, :priority
12
+ alias to_f priority
13
13
 
14
14
  def desc
15
15
  @desc && I18n.t(@desc)
16
16
  end
17
17
 
18
- alias_method :to_s, :desc
18
+ alias to_s desc
19
19
 
20
20
  def short_desc
21
21
  @short_desc && I18n.t(@short_desc)
22
22
  end
23
23
 
24
- def <=>(b)
25
- b.priority <=> self.priority
24
+ def <=>(other)
25
+ other.priority <=> priority
26
26
  end
27
27
 
28
28
  def solemnity?
@@ -66,7 +66,7 @@ module CalendariumRomanum
66
66
  end
67
67
 
68
68
  date = AbstractDate.new(month, day)
69
- return @days[date] || []
69
+ @days[date] || []
70
70
  end
71
71
 
72
72
  # for each day for which an entry is available
@@ -88,7 +88,7 @@ module CalendariumRomanum
88
88
 
89
89
  def freeze
90
90
  @days.freeze
91
- @days.values.each &:freeze
91
+ @days.values.each(&:freeze)
92
92
  @solemnities.freeze
93
93
  super
94
94
  end
@@ -12,22 +12,22 @@ module CalendariumRomanum
12
12
  class SanctoraleLoader
13
13
 
14
14
  RANK_CODES = {
15
- nil => Ranks::MEMORIAL_OPTIONAL,
16
- 'm' => Ranks::MEMORIAL_GENERAL,
17
- 'f' => Ranks::FEAST_GENERAL,
18
- 's' => Ranks::SOLEMNITY_GENERAL
19
- }
15
+ nil => Ranks::MEMORIAL_OPTIONAL,
16
+ 'm' => Ranks::MEMORIAL_GENERAL,
17
+ 'f' => Ranks::FEAST_GENERAL,
18
+ 's' => Ranks::SOLEMNITY_GENERAL
19
+ }.freeze
20
20
  COLOUR_CODES = {
21
- nil => Colours::WHITE,
22
- 'w' => Colours::WHITE,
23
- 'v' => Colours::VIOLET,
24
- 'g' => Colours::GREEN,
25
- 'r' => Colours::RED
26
- }
21
+ nil => Colours::WHITE,
22
+ 'w' => Colours::WHITE,
23
+ 'v' => Colours::VIOLET,
24
+ 'g' => Colours::GREEN,
25
+ 'r' => Colours::RED
26
+ }.freeze
27
27
 
28
28
  # dest should be a Sanctorale,
29
29
  # src anything with #each_line
30
- def load(src, dest=nil)
30
+ def load(src, dest = nil)
31
31
  dest ||= Sanctorale.new
32
32
 
33
33
  in_front_matter = false
@@ -51,7 +51,7 @@ module CalendariumRomanum
51
51
  next if l.empty?
52
52
 
53
53
  # month section heading
54
- n = l.match /^=\s*(\d+)\s*$/
54
+ n = l.match(/^=\s*(\d+)\s*$/)
55
55
  unless n.nil?
56
56
  month_section = n[1].to_i
57
57
  unless month_section >= 1 && month_section <= 12
@@ -61,10 +61,9 @@ module CalendariumRomanum
61
61
  end
62
62
 
63
63
  # celebration record
64
- m = l.match /^((\d+)\/)?(\d+)\s*(([mfs])?(\d\.\d{1,2})?)?\s*([WVRG])?\s*:(.*)$/i
64
+ m = l.match(/^((\d+)\/)?(\d+)\s*(([mfs])?(\d\.\d{1,2})?)?\s*([WVRG])?\s*:(.*)$/i)
65
65
  if m.nil?
66
66
  raise error("Syntax error, line skipped '#{l}'", line_num)
67
- next
68
67
  end
69
68
 
70
69
  month, day, rank_char, rank_num, colour, title = m.values_at(2, 3, 5, 6, 7, 8)
@@ -90,26 +89,34 @@ module CalendariumRomanum
90
89
  rank = rank_by_num
91
90
  end
92
91
 
93
- dest.add month, day, Celebration.new(
94
- title.strip,
95
- rank,
96
- COLOUR_CODES[colour && colour.downcase]
97
- )
92
+ begin
93
+ dest.add(
94
+ month,
95
+ day,
96
+ Celebration.new(
97
+ title.strip,
98
+ rank,
99
+ COLOUR_CODES[colour && colour.downcase]
100
+ )
101
+ )
102
+ rescue RangeError => err
103
+ raise error(err.message, line_num)
104
+ end
98
105
  end
99
106
 
100
107
  dest
101
108
  end
102
109
 
103
- alias_method :load_from_string, :load
110
+ alias load_from_string load
104
111
 
105
- def load_from_file(filename, dest=nil, encoding='utf-8')
106
- self.load File.open(filename, 'r', encoding: encoding), dest
112
+ def load_from_file(filename, dest = nil, encoding = 'utf-8')
113
+ load File.open(filename, 'r', encoding: encoding), dest
107
114
  end
108
115
 
109
116
  private
110
117
 
111
118
  def error(message, line_number)
112
- RuntimeError.new("L#{line_number}: #{message}")
119
+ InvalidDataError.new("L#{line_number}: #{message}")
113
120
  end
114
121
  end
115
122
  end
@@ -33,13 +33,13 @@ module CalendariumRomanum
33
33
  return year - 1
34
34
  end
35
35
 
36
- return year
36
+ year
37
37
  end
38
38
 
39
39
  # creates a Calendar for the liturgical year including given
40
40
  # date
41
41
  def for_day(date)
42
- return new(liturgical_year(date))
42
+ new(liturgical_year(date))
43
43
  end
44
44
 
45
45
  C = Struct.new(:date_method, :celebration)
@@ -49,43 +49,37 @@ module CalendariumRomanum
49
49
  def celebrations
50
50
  @celebrations ||=
51
51
  begin
52
- [
53
- c(:nativity, Ranks::PRIMARY),
54
- c(:holy_family, Ranks::FEAST_LORD_GENERAL),
55
- c(:mother_of_god, Ranks::SOLEMNITY_GENERAL),
56
- c(:epiphany, Ranks::PRIMARY),
57
- c(:baptism_of_lord, Ranks::FEAST_LORD_GENERAL),
58
- c(:ash_wednesday, Ranks::PRIMARY, Colours::VIOLET),
59
- c(:good_friday, Ranks::TRIDUUM, Colours::RED),
60
- c(:holy_saturday, Ranks::TRIDUUM, Colours::VIOLET),
61
- c(:palm_sunday, Ranks::PRIMARY, Colours::RED),
62
- c(:easter_sunday, Ranks::TRIDUUM),
63
- c(:ascension, Ranks::PRIMARY),
64
- c(:pentecost, Ranks::PRIMARY, Colours::RED),
65
- c(:holy_trinity, Ranks::SOLEMNITY_GENERAL),
66
- c(:corpus_christi, Ranks::SOLEMNITY_GENERAL),
67
- c(:sacred_heart, Ranks::SOLEMNITY_GENERAL),
68
- c(:christ_king, Ranks::SOLEMNITY_GENERAL),
69
-
70
- # Immaculate Heart of Mary is actually (currently the only one)
71
- # movable *sanctorale* feast, but as it would make little sense
72
- # to add support for movable sanctorale feasts because of
73
- # a single one, we cheat a bit and handle it in temporale.
74
- c(:immaculate_heart, Ranks::MEMORIAL_GENERAL),
75
- ]
52
+ %i(
53
+ nativity
54
+ holy_family
55
+ mother_of_god
56
+ epiphany
57
+ baptism_of_lord
58
+ ash_wednesday
59
+ good_friday
60
+ holy_saturday
61
+ palm_sunday
62
+ easter_sunday
63
+ ascension
64
+ pentecost
65
+ holy_trinity
66
+ corpus_christi
67
+ sacred_heart
68
+ christ_king
69
+ immaculate_heart
70
+ ).collect do |symbol|
71
+ date_method = symbol
72
+ C.new(
73
+ date_method,
74
+ CelebrationFactory.public_send(symbol)
75
+ )
76
+ end
77
+ # Immaculate Heart of Mary is actually (currently the only one)
78
+ # movable *sanctorale* feast, but as it would make little sense
79
+ # to add support for movable sanctorale feasts because of
80
+ # a single one, we cheat a bit and handle it in temporale.
76
81
  end
77
82
  end
78
-
79
- private
80
-
81
- def c(date_method, rank, colour=Colours::WHITE)
82
- title = proc { I18n.t("temporale.solemnity.#{date_method}") }
83
-
84
- C.new(
85
- date_method,
86
- Celebration.new(title, rank, colour)
87
- )
88
- end
89
83
  end
90
84
 
91
85
  def transferred_to_sunday?(solemnity)
@@ -97,7 +91,7 @@ module CalendariumRomanum
97
91
  end
98
92
 
99
93
  def end_date
100
- Dates.first_advent_sunday(year+1) - 1
94
+ Dates.first_advent_sunday(year + 1) - 1
101
95
  end
102
96
 
103
97
  def date_range
@@ -113,26 +107,8 @@ module CalendariumRomanum
113
107
  end
114
108
  end
115
109
 
116
- %i(
117
- first_advent_sunday
118
- nativity
119
- holy_family
120
- mother_of_god
121
- epiphany
122
- baptism_of_lord
123
- ash_wednesday
124
- palm_sunday
125
- good_friday
126
- holy_saturday
127
- easter_sunday
128
- ascension
129
- pentecost
130
- holy_trinity
131
- corpus_christi
132
- sacred_heart
133
- immaculate_heart
134
- christ_king
135
- ).each do |feast|
110
+ (celebrations.collect(&:date_method) + [:first_advent_sunday])
111
+ .each do |feast|
136
112
  if SUNDAY_TRANSFERABLE_SOLEMNITIES.include? feast
137
113
  define_method feast do
138
114
  Dates.public_send feast, year, sunday: transferred_to_sunday?(feast)
@@ -152,20 +128,20 @@ module CalendariumRomanum
152
128
  def season(date)
153
129
  range_check date
154
130
 
155
- if first_advent_sunday <= date and
156
- nativity > date then
131
+ if (first_advent_sunday <= date) &&
132
+ nativity > date
157
133
  Seasons::ADVENT
158
134
 
159
- elsif nativity <= date and
160
- baptism_of_lord >= date then
135
+ elsif (nativity <= date) &&
136
+ (baptism_of_lord >= date)
161
137
  Seasons::CHRISTMAS
162
138
 
163
- elsif ash_wednesday <= date and
164
- easter_sunday > date then
139
+ elsif (ash_wednesday <= date) &&
140
+ easter_sunday > date
165
141
  Seasons::LENT
166
142
 
167
- elsif easter_sunday <= date and
168
- pentecost >= date then
143
+ elsif (easter_sunday <= date) &&
144
+ (pentecost >= date)
169
145
  Seasons::EASTER
170
146
 
171
147
  else
@@ -183,8 +159,10 @@ module CalendariumRomanum
183
159
  ash_wednesday
184
160
  when Seasons::EASTER
185
161
  easter_sunday
186
- else # ordinary time
187
- Dates.monday_after(baptism_of_lord)
162
+ when Seasons::ORDINARY # ordinary time
163
+ baptism_of_lord + 1
164
+ else
165
+ raise ArgumentError.new('unsupported season')
188
166
  end
189
167
  end
190
168
 
@@ -202,13 +180,13 @@ module CalendariumRomanum
202
180
  week += 1
203
181
 
204
182
  if date > pentecost
205
- weeks_after_date = date_difference(Dates.first_advent_sunday(@year + 1), date) / 7
183
+ weeks_after_date = date_difference(Dates.first_advent_sunday(@year + 1), date) / WEEK
206
184
  week = 34 - weeks_after_date
207
185
  week += 1 if date.sunday?
208
186
  end
209
187
  end
210
188
 
211
- return week
189
+ week
212
190
  end
213
191
 
214
192
  # returns a Celebration
@@ -226,7 +204,7 @@ module CalendariumRomanum
226
204
  end
227
205
  end
228
206
 
229
- return @solemnities[date] || @feasts[date] || sunday(date) || @memorials[date] || ferial(date)
207
+ @solemnities[date] || @feasts[date] || sunday(date) || @memorials[date] || ferial(date)
230
208
  end
231
209
 
232
210
  private
@@ -246,7 +224,7 @@ module CalendariumRomanum
246
224
  week = Ordinalizer.ordinal season_week(seas, date)
247
225
  title = I18n.t "temporale.#{seas.to_sym}.sunday", week: week
248
226
 
249
- return Celebration.new title, rank, seas.colour
227
+ Celebration.new title, rank, seas.colour
250
228
  end
251
229
 
252
230
  def ferial(date)
@@ -258,6 +236,8 @@ module CalendariumRomanum
258
236
  when Seasons::ADVENT
259
237
  if date >= Date.new(@year, 12, 17)
260
238
  rank = Ranks::FERIAL_PRIVILEGED
239
+ nth = Ordinalizer.ordinal(date.day)
240
+ title = I18n.t 'temporale.advent.before_christmas', day: nth
261
241
  end
262
242
  when Seasons::CHRISTMAS
263
243
  if date < mother_of_god
@@ -266,32 +246,32 @@ module CalendariumRomanum
266
246
  nth = Ordinalizer.ordinal(date.day - nativity.day + 1) # 1-based counting
267
247
  title = I18n.t 'temporale.christmas.nativity_octave.ferial', day: nth
268
248
  elsif date > epiphany
269
- title = I18n.t "temporale.christmas.after_epiphany.ferial", weekday: I18n.t("weekday.#{date.wday}")
249
+ title = I18n.t 'temporale.christmas.after_epiphany.ferial', weekday: I18n.t("weekday.#{date.wday}")
270
250
  end
271
251
  when Seasons::LENT
272
252
  if week == 0
273
- title = I18n.t "temporale.lent.after_ashes.ferial", weekday: I18n.t("weekday.#{date.wday}")
253
+ title = I18n.t 'temporale.lent.after_ashes.ferial', weekday: I18n.t("weekday.#{date.wday}")
274
254
  elsif date > palm_sunday
275
255
  rank = Ranks::PRIMARY
276
- title = I18n.t "temporale.lent.holy_week.ferial", weekday: I18n.t("weekday.#{date.wday}")
256
+ title = I18n.t 'temporale.lent.holy_week.ferial', weekday: I18n.t("weekday.#{date.wday}")
277
257
  end
278
258
  rank = Ranks::FERIAL_PRIVILEGED unless rank > Ranks::FERIAL_PRIVILEGED
279
259
  when Seasons::EASTER
280
260
  if week == 1
281
261
  rank = Ranks::PRIMARY
282
- title = I18n.t "temporale.easter.octave.ferial", weekday: I18n.t("weekday.#{date.wday}")
262
+ title = I18n.t 'temporale.easter.octave.ferial', weekday: I18n.t("weekday.#{date.wday}")
283
263
  end
284
264
  end
285
265
 
286
266
  week_ord = Ordinalizer.ordinal week
287
267
  title ||= I18n.t "temporale.#{seas.to_sym}.ferial", week: week_ord, weekday: I18n.t("weekday.#{date.wday}")
288
268
 
289
- return Celebration.new title, rank, seas.colour
269
+ Celebration.new title, rank, seas.colour
290
270
  end
291
271
 
292
272
  # helper: difference between two Dates in days
293
273
  def date_difference(d1, d2)
294
- return (d1 - d2).numerator
274
+ (d1 - d2).numerator
295
275
  end
296
276
 
297
277
  # prepare dates of temporale solemnities
@@ -317,11 +297,12 @@ module CalendariumRomanum
317
297
  end
318
298
 
319
299
  def prepare_celebration_date(date_method, celebration)
320
- if date_method.respond_to? :call
321
- date = date_method.call(year)
322
- else
323
- date = public_send(date_method)
324
- end
300
+ date =
301
+ if date_method.respond_to? :call
302
+ date_method.call(year)
303
+ else
304
+ public_send(date_method)
305
+ end
325
306
 
326
307
  add_to =
327
308
  if celebration.feast?