Class: CalendariumRomanum::Transfers Private

Inherits:
Object
  • Object
show all
Defined in:
lib/calendarium-romanum/transfers.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Internal Calendar component. Resolves transfers of conflicting solemnities.

For any day Temporale has a Celebration. Often Sanctorale has one (or more), too. Calendar handles these conflicts, in most cases by throwing away all the proposed Celebrations except of the one of highest rank. But when there are two conflicting solemnities, one is celebrated on the given day and the less lucky one must be transferred to another day. However, not all days are valid as targets of solemnity transfer.

Instance Method Summary collapse

Constructor Details

#initialize(temporale, sanctorale) ⇒ Transfers

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Transfers.

Parameters:


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/calendarium-romanum/transfers.rb', line 20

def initialize(temporale, sanctorale)
  @transferred = {}
  @temporale = temporale
  @sanctorale = sanctorale

  dates = sanctorale.solemnities.keys.collect do |abstract_date|
    concretize_abstract_date abstract_date
  end.sort

  dates.each do |date|
    tc = temporale.get(date)
    next unless tc.solemnity?

    sc = sanctorale.get(date)
    next unless sc.size == 1 && sc.first.solemnity?

    loser = [tc, sc.first].sort_by(&:rank).first

    transfer_to = date
    begin
      transfer_to = transfer_to.succ
    end until valid_destination?(transfer_to)
    @transferred[transfer_to] = loser
  end
end

Instance Method Details

#get(date) ⇒ Celebration?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Retrieve solemnity for the specified day

Parameters:

  • date (Date)

Returns:


50
51
52
# File 'lib/calendarium-romanum/transfers.rb', line 50

def get(date)
  @transferred[date]
end