Class: LWAC::CSVFormatter
- Inherits:
-
KeyValueFormatter
- Object
- Formatter
- KeyValueFormatter
- LWAC::CSVFormatter
- Defined in:
- lib/lwac/export/format.rb
Overview
Output to a single CSV file
Instance Method Summary collapse
Methods inherited from KeyValueFormatter
#add_data, #initialize, #open_point
Methods inherited from Formatter
#<<, #add_data, #initialize, #open_point
Constructor Details
This class inherits a constructor from LWAC::KeyValueFormatter
Instance Method Details
#close_output ⇒ Object
128 129 130 131 |
# File 'lib/lwac/export/format.rb', line 128 def close_output() $log.info "Closing output CSV..." @csv.close end |
#close_point ⇒ Object
138 139 140 141 |
# File 'lib/lwac/export/format.rb', line 138 def close_point() super @csv << (@line.values) end |
#open_output ⇒ Object
122 123 124 125 126 |
# File 'lib/lwac/export/format.rb', line 122 def open_output() $log.info "Opening #{@config[:filename]} for writing..." $log.debug "Options for CSV: #{@config[:csv_opts]}" @csv = CSV.open(@config[:filename], 'w', @config[:csv_opts] || {}) end |
#write_header ⇒ Object
133 134 135 136 |
# File 'lib/lwac/export/format.rb', line 133 def write_header $log.info "Writing header" @csv << @config[:fields].keys end |