Class: Pageflow::FileImporters

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/pageflow/file_importers.rb

Overview

List of file importers will be maintained using this class File importer plugin is required to register itself to this list

Instance Method Summary collapse

Constructor Details

#initializeFileImporters

Returns a new instance of FileImporters.



7
8
9
# File 'lib/pageflow/file_importers.rb', line 7

def initialize
  clear
end

Instance Method Details

#clearObject



15
16
17
# File 'lib/pageflow/file_importers.rb', line 15

def clear
  @file_importers = {}
end

#each(&block) ⇒ Object



19
20
21
# File 'lib/pageflow/file_importers.rb', line 19

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

#fetch_by_name(name, &block) ⇒ Object



29
30
31
# File 'lib/pageflow/file_importers.rb', line 29

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

#find_by_name!(name) ⇒ Object



23
24
25
26
27
# File 'lib/pageflow/file_importers.rb', line 23

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

#register(file_importer) ⇒ Object



11
12
13
# File 'lib/pageflow/file_importers.rb', line 11

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