Class: Defmastership::Export::CSV::Formatter
- Defined in:
- lib/defmastership/export/csv/formatter.rb
Overview
to export a CSV file
Instance Attribute Summary
Attributes inherited from Formatter
Instance Method Summary collapse
-
#export_to(output_file) ⇒ Object
Export the document to a CSV file.
-
#initialize(doc, separator: ',') ⇒ Formatter
constructor
A new instance of Formatter.
Methods inherited from Formatter
Constructor Details
#initialize(doc, separator: ',') ⇒ Formatter
Returns a new instance of Formatter.
15 16 17 18 |
# File 'lib/defmastership/export/csv/formatter.rb', line 15 def initialize(doc, separator: ',') @sep = separator super(doc) end |
Instance Method Details
#export_to(output_file) ⇒ Object
Export the document to a CSV file
23 24 25 26 27 28 29 |
# File 'lib/defmastership/export/csv/formatter.rb', line 23 def export_to(output_file) column_list = build_column_list ::CSV.open(output_file, 'w:ISO-8859-1', col_sep: @sep) do |csv| csv << header(column_list) export_definitions_in(csv, column_list) end end |