Sha256: 3557b3f8ba79a87f1c19bf3d37d88d93e5c15e5c5c98e9cfc2a9613df9cbdd5e
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
module DocParser # The MultiOutput output combines multiple outputs. # It creates a CSV, HTML, YAML and XLSX Output file # @see CSVOutput # @see HTMLOutput # @see YAMLOutput # @see XLSXOutput # @see Output class MultiOutput < Output # @!visibility private def initialize(**options) @outputs = [] csvoptions = options.clone csvoptions[:filename] += '.csv' htmloptions = options.clone htmloptions[:filename] += '.html' yamloptions = options.clone yamloptions[:filename] += '.yml' xlsxoptions = options.clone xlsxoptions[:filename] += '.xlsx' jsonoptions = options.clone jsonoptions[:filename] += '.json' @outputs << CSVOutput.new(csvoptions) @outputs << HTMLOutput.new(htmloptions) @outputs << YAMLOutput.new(yamloptions) @outputs << XLSXOutput.new(xlsxoptions) @outputs << XLSXOutput.new(jsonoptions) end def header=(row) @outputs.each { |out| out.header = row.flatten } end def add_row(row) @outputs.each { |out| out.add_row row.flatten } end def rowcount @outputs.min { |out| out.rowcount }.rowcount end def close @outputs.each { |out| out.close } end def summary @outputs.map { |out| out.summary }.join("\n") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
docparser-0.0.1 | lib/docparser/output/multi_output.rb |