Class: CalendariumRomanum::Transfers

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

Overview

Resolves transfers of solemnities.

Instance Method Summary collapse

Constructor Details

#initialize(temporale, sanctorale) ⇒ Transfers

Returns a new instance of Transfers.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/calendarium-romanum/transfers.rb', line 5

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) ⇒ Object



31
32
33
# File 'lib/calendarium-romanum/transfers.rb', line 31

def get(date)
  @transferred[date]
end