module CalendariumRomanum::Temporale::Dates
Provides methods computing dates of movable feasts and utilities for common computations of relative dates
Public Instance Methods
ascension(year, sunday: false)
click to toggle source
(see .epiphany)
# File lib/calendarium-romanum/temporale/dates.rb, line 107 def ascension(year, sunday: false) if sunday # GNLYC 7 b) return easter_sunday(year) + 6 * WEEK end pentecost(year) - 10 end
ash_wednesday(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 60 def ash_wednesday(year) easter_sunday(year) - (6 * WEEK + 4) end
baptism_of_lord(year, epiphany_on_sunday: false)
click to toggle source
@param year [Integer] liturgical year @param epiphany_on_sunday [Boolean] was Epiphany transferred to Sunday? @return [Date]
# File lib/calendarium-romanum/temporale/dates.rb, line 50 def baptism_of_lord(year, epiphany_on_sunday: false) e = epiphany(year, sunday: epiphany_on_sunday) if e.day > 6 e + 1 else sunday_after e end end
christ_king(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 152 def christ_king(year) first_advent_sunday(year + 1) - 7 end
corpus_christi(year, sunday: false)
click to toggle source
(see .epiphany)
# File lib/calendarium-romanum/temporale/dates.rb, line 127 def corpus_christi(year, sunday: false) if sunday # GNLYC 7 c) return holy_trinity(year) + WEEK end holy_trinity(year) + 4 end
easter_sunday(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 65 def easter_sunday(year) year += 1 # algorithm below taken from the 'easter' gem: # https://github.com/jrobertson/easter golden_number = (year % 19) + 1 dominical_number = (year + (year / 4) - (year / 100) + (year / 400)) % 7 solar_correction = (year - 1600) / 100 - (year - 1600) / 400 lunar_correction = (((year - 1400) / 100) * 8) / 25 paschal_full_moon = (3 - 11 * golden_number + solar_correction - lunar_correction) % 30 dominical_number += 7 until dominical_number > 0 paschal_full_moon += 30 until paschal_full_moon > 0 paschal_full_moon -= 1 if (paschal_full_moon == 29) || ((paschal_full_moon == 28) && golden_number > 11) difference = (4 - paschal_full_moon - dominical_number) % 7 difference += 7 if difference < 0 day_easter = paschal_full_moon + difference + 1 if day_easter < 11 # Easter occurs in March. return Date.new(year, 3, day_easter + 21) else # Easter occurs in April. return Date.new(year, 4, day_easter - 10) end end
epiphany(year, sunday: false)
click to toggle source
@param year [Integer] liturgical year @param sunday [Boolean] transfer to Sunday? @return [Date]
# File lib/calendarium-romanum/temporale/dates.rb, line 38 def epiphany(year, sunday: false) if sunday # GNLYC 7 a) return sunday_after(Date.new(year + 1, 1, 1)) end Date.new(year + 1, 1, 6) end
first_advent_sunday(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 10 def first_advent_sunday(year) sunday_before(nativity(year)) - 3 * WEEK end
good_friday(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 97 def good_friday(year) easter_sunday(year) - 2 end
holy_family(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 21 def holy_family(year) xmas = nativity(year) if xmas.sunday? return Date.new(year, 12, 30) else sunday_after(xmas) end end
holy_saturday(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 102 def holy_saturday(year) easter_sunday(year) - 1 end
holy_trinity(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 122 def holy_trinity(year) octave_of(pentecost(year)) end
immaculate_heart(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 147 def immaculate_heart(year) pentecost(year) + 20 end
mother_of_church(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 142 def mother_of_church(year) pentecost(year) + 1 end
mother_of_god(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 31 def mother_of_god(year) octave_of(nativity(year)) end
nativity(year)
click to toggle source
@param year [Integer] liturgical year @return [Date]
# File lib/calendarium-romanum/temporale/dates.rb, line 16 def nativity(year) Date.new(year, 12, 25) end
palm_sunday(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 92 def palm_sunday(year) easter_sunday(year) - 7 end
pentecost(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 117 def pentecost(year) easter_sunday(year) + 7 * WEEK end
sacred_heart(year)
click to toggle source
(see nativity
)
# File lib/calendarium-romanum/temporale/dates.rb, line 137 def sacred_heart(year) corpus_christi(year) + 8 end