Sha256: 8cdd616a4111941336bf8a11da5faa3d5f8040b1c7cbd6231df56a9058f30f43

Contents?: true

Size: 467 Bytes

Versions: 6

Compression:

Stored size: 467 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, **)
          reader = Readers.search_by_mime_type(mime_type)
          raise NotImplementedError, "No reader implemented for mime type: #{mime_type}" if reader.nil?

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.29.1 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.29.0 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.29.0.rc4 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.29.0.rc3 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.29.0.rc2 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.29.0.rc1 lib/decidim/admin/import/importer_factory.rb