class Decidim::Exporters::Exporter

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

Attributes

collection[R]
serializer[R]

Public Class Methods

new(collection, serializer = Serializer) click to toggle source

Public: Initializes an Exporter.

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

# File lib/decidim/exporters/exporter.rb, line 13
def initialize(collection, serializer = Serializer)
  @collection = collection
  @serializer = serializer
end

Public Instance Methods

export() click to toggle source

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

# File lib/decidim/exporters/exporter.rb, line 20
def export
  raise NotImplementedError
end