Sha256: d63c03a72257b91fc64eddf347561c262e81152cca6191a789df82d45faf7aa2

Contents?: true

Size: 491 Bytes

Versions: 7

Compression:

Stored size: 491 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:, reader:, **keyword_args)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-admin-0.28.4 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.28.3 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.28.2 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.28.1 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.28.0 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.28.0.rc5 lib/decidim/admin/import/importer_factory.rb
decidim-admin-0.28.0.rc4 lib/decidim/admin/import/importer_factory.rb