Sha256: c49c5ed20279a3308752ad391382d5feee2f569c918335cacd1b2c8fb01b6d5a
Contents?: true
Size: 1.2 KB
Versions: 5
Compression:
Stored size: 1.2 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 << JSONOutput.new(jsonoptions) end def header=(row) @outputs.each { |out| out.header = row } end def add_row(row) @outputs.each { |out| out.add_row row } end def rowcount @outputs.map { |out| out.rowcount }.min end def close @outputs.each { |out| out.close } end end end
Version data entries
5 entries across 5 versions & 1 rubygems