Sha256: 5e7a6384bf8fa20391350466ecfdafb1aaa2469ba3d5fac01f8b725fed121ae7

Contents?: true

Size: 503 Bytes

Versions: 37

Compression:

Stored size: 503 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    module Import
      # A factory class providing easier way to create new importers.
      class ImporterFactory
        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
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
decidim-admin-0.26.1 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.26.0 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.26.0.rc2 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.26.0.rc1 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.25.2 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.25.1 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.25.0 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.25.0.rc4 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.25.0.rc3 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.25.0.rc2 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.25.0.rc1 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.24.3 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.24.2 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.24.1 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.24.0 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.24.0.rc2 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.24.0.rc1 lib/decidim/admin/import/importer_factory.rb