Class: Calrom::Formatter::Csv

Inherits:
Object
  • Object
show all
Defined in:
lib/calrom/formatter/csv.rb

Instance Method Summary collapse

Instance Method Details

#call(calendar, date_range) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/calrom/formatter/csv.rb', line 6

def call(calendar, date_range)
  CSV do |out|
    out << %w(date title symbol rank rank_num colour season)

    date_range.each do |date|
      day = calendar[date]
      day.celebrations.each do |c|
        out << [
          day.date,
          c.title,
          c.symbol,
          c.rank.short_desc,
          c.rank.priority,
          c.colour.symbol,
          day.season.symbol
        ]
      end
    end
  end
end