Class: CSVPlusPlus::Writer::CSV

Inherits:
BaseWriter show all
Defined in:
lib/csv_plus_plus/writer/csv.rb

Overview

A class that can output a Template to CSV

Instance Attribute Summary

Attributes inherited from BaseWriter

#options

Instance Method Summary collapse

Instance Method Details

#write(template) ⇒ Object

write a template to CSV



9
10
11
12
13
14
15
16
# File 'lib/csv_plus_plus/writer/csv.rb', line 9

def write(template)
  # TODO: also read it and merge the results
  ::CSV.open(@options.output_filename, 'wb') do |csv|
    template.rows.each do |row|
      csv << build_row(row)
    end
  end
end