Sha256: 67c2284c980feeda930c769057d90c8d74e6c45e00aa3b610d5381536005fd64

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

require 'zt/constants'
require 'zt/importers/_base_importer'
require 'zt/importers/network_importer'
require 'zt/importers/node_importer'

module Zt
  module Importers
    class Importer
      attr_accessor :importers
      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

      # @return [Array[Hash]] an array of hashes from each exporter.
      # NOTE there may be value in attributing each hash to its
      # importer, consider that for later as a Hash[Hash].
      def import
        @importers.map(&:import)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zt-0.1.1 lib/zt/importers.rb