Class: Decidim::Exporters::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/exporters/exporter.rb

Overview

Abstract class providing the interface and partial implementation of an exporter. See ‘Decidim::Exporters::JSON` and `Decidim::Exporters::CSV` for a reference implementation.

Direct Known Subclasses

CSV, JSON, PDF

Instance Method Summary collapse

Constructor Details

#initialize(collection, serializer = Serializer) ⇒ Exporter

Public: Initializes an Exporter.

collection - An Array with the collection to be exported. serializer - A Serializer to be used during the export.



13
14
15
16
# File 'lib/decidim/exporters/exporter.rb', line 13

def initialize(collection, serializer = Serializer)
  @collection = collection
  @serializer = serializer
end

Instance Method Details

#exportObject

Public: Should generate an ‘ExportData` with the result of the export. Responsibility of the subclass.

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/decidim/exporters/exporter.rb', line 20

def export
  raise NotImplementedError
end