Class: Decidim::Admin::Import::ImporterFactory

Inherits:
Object
  • Object
show all
Defined in:
decidim-admin/lib/decidim/admin/import/importer_factory.rb

Overview

A factory class providing easier way to create new importers.

Class Method Summary collapse

Class Method Details

.build(file, mime_type, **keyword_args) ⇒ Object

Raises:

  • (NotImplementedError)

8
9
10
11
12
13
# File 'decidim-admin/lib/decidim/admin/import/importer_factory.rb', line 8

def self.build(file, mime_type, **keyword_args)
  reader = Readers.search_by_mime_type(mime_type)
  raise NotImplementedError, "No reader implemented for mime type: #{mime_type}" if reader.nil?

  Importer.new(file: file, reader: reader, **keyword_args)
end