Sha256: 5f915205209b513cce7b39e37d2dc1ba8598e614472195512367a4652b6ccfaa

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

# require 'active_support/core_ext/module/attribute_accessors'
module ActiveList

  module Exporters

    def self.hash
      ActiveList.exporters
    end

    autoload :AbstractExporter,                'active_list/exporters/abstract_exporter'
    autoload :OpenDocumentSpreadsheetExporter, 'active_list/exporters/open_document_spreadsheet_exporter'
    autoload :CsvExporter,                     'active_list/exporters/csv_exporter'
    autoload :ExcelCsvExporter,                'active_list/exporters/excel_csv_exporter'
  end

  mattr_reader :exporters
  @@exporters = {}

  def self.register_exporter(name, exporter)
    raise ArgumentError.new("ActiveList::Exporters::AbstractExporter expected (got #{exporter.name}/#{exporter.ancestors.inspect})") unless exporter < ActiveList::Exporters::AbstractExporter
    @@exporters[name] = exporter
  end

end

ActiveList.register_exporter(:ods,  ActiveList::Exporters::OpenDocumentSpreadsheetExporter)
ActiveList.register_exporter(:csv,  ActiveList::Exporters::CsvExporter)
ActiveList.register_exporter(:xcsv, ActiveList::Exporters::ExcelCsvExporter)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active-list-5.0.1 lib/active_list/exporters.rb
active-list-5.0.0 lib/active_list/exporters.rb