Class: Zt::Exporters::Exporter
- Inherits:
-
Object
- Object
- Zt::Exporters::Exporter
- Defined in:
- lib/zt/exporters.rb
Instance Method Summary collapse
-
#export ⇒ Array[Hash]
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.
- #export_one_format(format) ⇒ Object
-
#initialize(*exporter_names) ⇒ Exporter
constructor
A new instance of Exporter.
Constructor Details
#initialize(*exporter_names) ⇒ Exporter
Returns a new instance of Exporter.
10 11 12 13 14 15 |
# 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 |
Instance Method Details
#export ⇒ Array[Hash]
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.
23 24 25 |
# File 'lib/zt/exporters.rb', line 23 def export @exporters.map(&:export) end |
#export_one_format(format) ⇒ Object
27 28 29 |
# File 'lib/zt/exporters.rb', line 27 def export_one_format(format) Zt::Exporters::HostsFileExporter.new.export if format == :hosts end |