Class: Zt::Importers::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/zt/importers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(networks, nodes, *importer_names) ⇒ Importer

Returns a new instance of Importer.



12
13
14
15
16
17
18
# File 'lib/zt/importers.rb', line 12

def initialize(networks, nodes, *importer_names)
  importer_names = Zt::Constants::ALL_IMPORTERS if importer_names.empty?
  importer_classes = importer_names.map do |n|
    Zt::Importers.const_get(n)
  end
  @importers = importer_classes.map { |c| c.new(networks, nodes) }
end

Instance Attribute Details

#importersObject

Returns the value of attribute importers.



11
12
13
# File 'lib/zt/importers.rb', line 11

def importers
  @importers
end

Instance Method Details

#importArray[Hash]

NOTE there may be value in attributing each hash to its importer, consider that for later as a Hash.

Returns:

  • (Array[Hash])

    an array of hashes from each exporter.



23
24
25
# File 'lib/zt/importers.rb', line 23

def import
  @importers.map(&:import)
end