Sha256: b9d180e5d89392983c08946e986d588159aca046d704ca09785ef047fd5e5be9

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

# frozen_string_literal: true
module Decidim
  module Exporters
    # Abstract class providing the interface and partial implementation
    # of an exporter. See `Decidim::Exporters::JSON` and `Decidim::Exporters::CSV`
    # for a reference implementation.
    class Exporter
      # Public: Initializes an Exporter.
      #
      # collection - An Array with the collection to be exported.
      # serializer - A Serializer to be used during the export.
      def initialize(collection, serializer)
        @collection = collection
        @serializer = serializer
      end

      # Public: Should generate an `ExportData` with the result of the export.
      # Responsibility of the subclass.
      def export
        raise NotImplementedError
      end

      private

      attr_reader :collection, :serializer
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-core-0.1.0 lib/decidim/exporters/exporter.rb