Sha256: 5d5cd0900e9dbe9f43af0812f3f20a357132e072b1ee08c307f181be1570e6e7
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require 'zt/constants' require 'zt/exporters/_base_exporter' require 'zt/exporters/hosts_file_exporter' module Zt module Exporters class Exporter def initialize(*exporter_names) exporter_names = Zt::Constants::ALL_EXPORTERS if exporter_names.empty? exporter_classes = exporter_names.map { |n| Zt::Exporters.const_get(n) } @exporters = exporter_classes.map(&:new) end # @return [Array[Hash]] an array of hashes from each exporter # The hash is in form { data: Object, mangle: lambda } # with the :mangle lambda containing any steps to apply the Object # like rewriting /etc/hosts or sending the data elsewhere. # NOTE there may be value in attributing each hash to its # importer, consider that for later as a Hash[Hash]. def export @exporters.map(&:export) end def export_one_format(format) Zt::Exporters::HostsFileExporter.new.export if format == :hosts end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zt-0.1.1 | lib/zt/exporters.rb |