Skip to content

Instantly share code, notes, and snippets.

@igneus
Created June 15, 2023 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igneus/93b46a7edfbb6cfabaa48f022299bbf7 to your computer and use it in GitHub Desktop.
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?
# 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