Class: CSVPlusPlus::Writer::CSV

Inherits:
BaseWriter show all
Includes:
FileBackerUpper
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

Methods included from FileBackerUpper

#write_backup

Instance Method Details

#write(template) ⇒ Object

write a template to CSV



12
13
14
15
16
17
18
19
# File 'lib/csv_plus_plus/writer/csv.rb', line 12

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