Sha256: 736f458d138550dea3ab34e6e66f51f1f0c03bb5864de94614eb850718cb9260

Contents?: true

Size: 686 Bytes

Versions: 27

Compression:

Stored size: 686 Bytes

Contents

module Pageflow
  # List of file importers will be maintained using this class
  # File importer plugin is required to register itself to this list
  class FileImporters
    include Enumerable

    def initialize
      clear
    end

    def register(file_importer)
      @file_importers[file_importer.name] = file_importer
    end

    def clear
      @file_importers = {}
    end

    def each(&block)
      @file_importers.values.each(&block)
    end

    def find_by_name!(name)
      fetch_by_name(name) do
        raise "Unknown file importer with name '#{name}'."
      end
    end

    def fetch_by_name(name, &block)
      @file_importers.fetch(name, &block)
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
pageflow-17.0.4 lib/pageflow/file_importers.rb
pageflow-17.0.3 lib/pageflow/file_importers.rb
pageflow-17.0.2 lib/pageflow/file_importers.rb
pageflow-17.0.1 lib/pageflow/file_importers.rb
pageflow-17.0.0 lib/pageflow/file_importers.rb
pageflow-16.2.0 lib/pageflow/file_importers.rb
pageflow-16.1.0 lib/pageflow/file_importers.rb
pageflow-16.0.0 lib/pageflow/file_importers.rb
pageflow-15.8.0 lib/pageflow/file_importers.rb
pageflow-15.7.1 lib/pageflow/file_importers.rb
pageflow-15.7.0 lib/pageflow/file_importers.rb
pageflow-15.6.1 lib/pageflow/file_importers.rb
pageflow-15.6.0 lib/pageflow/file_importers.rb
pageflow-15.5.0 lib/pageflow/file_importers.rb
pageflow-15.4.0 lib/pageflow/file_importers.rb
pageflow-15.3.0 lib/pageflow/file_importers.rb
pageflow-15.2.2 lib/pageflow/file_importers.rb
pageflow-15.2.1 lib/pageflow/file_importers.rb
pageflow-15.2.0 lib/pageflow/file_importers.rb
pageflow-15.1.2 lib/pageflow/file_importers.rb