Class: Calrom::Formatter::Calendars

Inherits:
Calrom::Formatter show all
Defined in:
lib/calrom/formatter/calendars.rb

Overview

Prints list of available bundled calendars

Instance Method Summary collapse

Instance Method Details

#call(calendar, date_range) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/calrom/formatter/calendars.rb', line 7

def call(calendar, date_range)
  last_locale = nil
  CR::Data.each do |d|
    meta = load_front_matter d
    puts if last_locale && last_locale != meta['locale']
    puts "%-20s:  %s  [%s]" % [d.siglum, meta['title'], meta['locale']]
    last_locale = meta['locale']
  end
end

#load_front_matter(data_file) ⇒ Object



17
18
19
# File 'lib/calrom/formatter/calendars.rb', line 17

def load_front_matter(data_file)
  YAML.load File.read data_file.path
end