Created
June 15, 2023 15:24
-
-
Save igneus/93b46a7edfbb6cfabaa48f022299bbf7 to your computer and use it in GitHub Desktop.
Which sanctorale feasts are celebrated on inverse dates like 2/5 x 5/2?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Which sanctorale feasts are celebrated on inverse dates like 2/5 x 5/2? | |
require 'calendarium-romanum/cr' | |
class CR::AbstractDate | |
def inverse | |
return nil if day > 12 || day == month | |
self.class.new(day, month) | |
end | |
end | |
def format(date, celebrations) | |
"#{date.month}/#{date.day} " + | |
celebrations.collect(&:symbol).join(', ') | |
end | |
cal = ARGV[0] || 'universal-en' | |
sanctorale = CR::Data[cal].load_with_parents | |
sanctorale.each_day do |date, celebrations| | |
inverse = date.inverse | |
next unless inverse && !sanctorale[inverse].empty? | |
next if inverse < date # print each pair only once | |
print format date, celebrations | |
print ' x ' | |
puts format inverse, sanctorale[inverse] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment