class Zt::Exporters::Exporter
Public Class Methods
new(*exporter_names)
click to toggle source
# File lib/zt/exporters.rb, line 10 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
Public Instance Methods
export()
click to toggle source
@return [Array] 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.
# File lib/zt/exporters.rb, line 23 def export @exporters.map(&:export) end
export_one_format(format)
click to toggle source
# File lib/zt/exporters.rb, line 27 def export_one_format(format) Zt::Exporters::HostsFileExporter.new.export if format == :hosts end