Module: CSVPlusPlus::Writer
- Extended by:
- T::Sig
- Defined in:
- lib/csv_plus_plus/writer.rb,
lib/csv_plus_plus/writer/csv.rb,
lib/csv_plus_plus/writer/excel.rb,
lib/csv_plus_plus/writer/merger.rb,
lib/csv_plus_plus/writer/writer.rb,
lib/csv_plus_plus/writer/google_sheets.rb,
lib/csv_plus_plus/writer/open_document.rb,
lib/csv_plus_plus/writer/rubyxl_builder.rb,
lib/csv_plus_plus/writer/file_backer_upper.rb,
lib/csv_plus_plus/writer/google_sheets_builder.rb
Overview
Various strategies for writing to various formats (excel, google sheets, CSV & OpenDocument (not yet implemented))
Defined Under Namespace
Modules: FileBackerUpper, Merger Classes: CSV, Excel, GoogleSheets, GoogleSheetsBuilder, OpenDocument, RubyXLBuilder, Writer
Class Method Summary collapse
-
.csv(options, position) ⇒ Object
Instantiate a
CSV
writer. -
.excel(options, position) ⇒ Object
Instantiate a
Excel
writer. -
.google_sheets(options, position) ⇒ Object
Instantiate a
GoogleSheets
writer. -
.open_document(options, position) ⇒ Object
Instantiate an
OpenDocument
writer. -
.writer(options, position) ⇒ Writer::CSV | Writer::Excel | Writer::GoogleSheets | Writer::OpenDocument
Return an instance of a writer depending on the given
options
.
Class Method Details
.csv(options, position) ⇒ Object
Instantiate a CSV
writer
56 57 58 |
# File 'lib/csv_plus_plus/writer.rb', line 56 def self.csv(, position) ::CSVPlusPlus::Writer::CSV.new(::T.cast(, ::CSVPlusPlus::Options::FileOptions), position) end |
.excel(options, position) ⇒ Object
Instantiate a Excel
writer
67 68 69 |
# File 'lib/csv_plus_plus/writer.rb', line 67 def self.excel(, position) ::CSVPlusPlus::Writer::Excel.new(::T.cast(, ::CSVPlusPlus::Options::FileOptions), position) end |
.google_sheets(options, position) ⇒ Object
Instantiate a GoogleSheets
writer
78 79 80 |
# File 'lib/csv_plus_plus/writer.rb', line 78 def self.google_sheets(, position) ::CSVPlusPlus::Writer::GoogleSheets.new(::T.cast(, ::CSVPlusPlus::Options::GoogleSheetsOptions), position) end |
.open_document(options, position) ⇒ Object
Instantiate an OpenDocument
writer
89 90 91 |
# File 'lib/csv_plus_plus/writer.rb', line 89 def self.open_document(, position) ::CSVPlusPlus::Writer::OpenDocument.new(::T.cast(, ::CSVPlusPlus::Options::FileOptions), position) end |
.writer(options, position) ⇒ Writer::CSV | Writer::Excel | Writer::GoogleSheets | Writer::OpenDocument
Return an instance of a writer depending on the given options
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/csv_plus_plus/writer.rb', line 38 def self.writer(, position) output_format = .output_format case output_format when ::CSVPlusPlus::Options::OutputFormat::CSV then csv(, position) when ::CSVPlusPlus::Options::OutputFormat::Excel then excel(, position) when ::CSVPlusPlus::Options::OutputFormat::GoogleSheets then google_sheets(, position) when ::CSVPlusPlus::Options::OutputFormat::OpenDocument then open_document(, position) else ::T.absurd(output_format) end end |