Class: Defmastership::Export::CSV::Formatter
- Inherits:
-
Object
- Object
- Defmastership::Export::CSV::Formatter
- Defined in:
- lib/defmastership/export/csv/formatter.rb
Overview
to export a CSV file
Instance Method Summary collapse
-
#export_to(output_file) ⇒ Object
Export the document to a CSV file.
-
#initialize(doc, sep) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(doc, sep) ⇒ Formatter
Returns a new instance of Formatter.
17 18 19 20 |
# File 'lib/defmastership/export/csv/formatter.rb', line 17 def initialize(doc, sep) @doc = doc @sep = sep end |
Instance Method Details
#export_to(output_file) ⇒ Object
Export the document to a CSV file
25 26 27 28 29 30 31 |
# File 'lib/defmastership/export/csv/formatter.rb', line 25 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 |