Sha256: 7558cad6ea7217e46887c394de09c674b5ce17d640f154bd60f09397be3bfb6a

Contents?: true

Size: 620 Bytes

Versions: 1

Compression:

Stored size: 620 Bytes

Contents

require 'csv'

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

          calendar.each_day_in_range(date_range) do |day|
            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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calrom-0.4.0 lib/calrom/formatter/csv.rb