Class: CalendariumRomanum::Transfers Private
- Inherits:
-
Object
- Object
- CalendariumRomanum::Transfers
- 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.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object private
-
#initialize(temporale, sanctorale) ⇒ Transfers
constructor
private
A new instance of Transfers.
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.
20 21 22 23 |
# File 'lib/calendarium-romanum/transfers.rb', line 20 def initialize(temporale, sanctorale) @temporale = temporale @sanctorale = sanctorale end |
Class Method Details
.call(temporale, sanctorale) ⇒ Object
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.
25 26 27 |
# File 'lib/calendarium-romanum/transfers.rb', line 25 def self.call(temporale, sanctorale) new(temporale, sanctorale).call end |
Instance Method Details
#call ⇒ Object
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.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/calendarium-romanum/transfers.rb', line 29 def call @transferred = {} dates = @sanctorale.solemnities.keys.collect do |abstract_date| concretize_abstract_date abstract_date end.sort dates.each do |date| tc = @temporale[date] next unless tc.solemnity? sc = @sanctorale[date] next unless sc.size == 1 && sc.first.solemnity? loser = [tc, sc.first].sort_by(&:rank).first transfer_to = if loser.symbol == :annunciation && in_holy_week?(date) monday_easter2 = @temporale.easter_sunday + 8 valid_destination?(monday_easter2) ? monday_easter2 : free_day_closest_to(monday_easter2) else free_day_closest_to(date) end @transferred[transfer_to] = loser end @transferred end |