Module: Decidim::Exporters

Defined in:
lib/decidim/exporters.rb,
lib/decidim/exporters/csv.rb,
lib/decidim/exporters/pdf.rb,
lib/decidim/exporters/json.rb,
lib/decidim/exporters/excel.rb,
lib/decidim/exporters/exporter.rb,
lib/decidim/exporters/export_data.rb,
lib/decidim/exporters/export_manifest.rb,
app/serializers/decidim/exporters/serializer.rb,
app/serializers/decidim/exporters/participatory_space_components_serializer.rb

Defined Under Namespace

Classes: CSV, Excel, ExportData, ExportManifest, Exporter, JSON, PDF, ParticipatorySpaceComponentsSerializer, Serializer, UnknownFormatError

Constant Summary collapse

EXPORT_FORMATS =

Lock the export formats to one of the available exporters

[:JSON, :CSV, :Excel, :PDF, :FormPDF].freeze

Class Method Summary collapse

Class Method Details

.find_exporter(format) ⇒ Object

Get the exporter class constant from the format as a string.

format - The exporter format as a string. i.e “CSV”

Raises:



26
27
28
29
30
31
32
# File 'lib/decidim/exporters.rb', line 26

def self.find_exporter(format)
  raise UnknownFormatError unless format.respond_to?(:to_sym)
  raise UnknownFormatError unless EXPORT_FORMATS.include?(format.to_sym)
  raise UnknownFormatError unless const_defined?(format.to_sym)

  const_get(format.to_sym)
end