Class: CalendariumRomanum::Temporale::EasterTable
- Inherits:
-
Object
- Object
- CalendariumRomanum::Temporale::EasterTable
- Defined in:
- lib/calendarium-romanum/temporale/easter_table.rb
Overview
Class Method Summary collapse
-
.load_from(src) ⇒ Hash<Integer=>Date>
Loads an Easter table from a String- or IO-like object
src
.
Class Method Details
.load_from(src) ⇒ Hash<Integer=>Date>
Loads an Easter table from a String- or IO-like object src
. src
must contain Easter dates, parseable by Date.parse
, one date per line. Blank lines and bash-like comments are ignored. Returns a Hash
mapping (liturgical) year to Easter date.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/calendarium-romanum/temporale/easter_table.rb', line 12 def self.load_from(src) r = {} src.each_line do |l| cleaned = l.sub(/#.*$/, '').strip next if cleaned == '' date = Date.parse cleaned liturgical_year = date.year - 1 r[liturgical_year] = date end r end |