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/base_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_sheet_builder.rb

Overview

Various strategies for writing to various formats (excel, google sheets, CSV & OpenDocument (not yet implemented))

Defined Under Namespace

Modules: FileBackerUpper Classes: BaseWriter, CSV, Excel, GoogleSheetBuilder, GoogleSheets, OpenDocument, RubyXLBuilder

Class Method Summary collapse

Class Method Details

.writer(options, runtime) ⇒ Writer::CSV | Writer::Excel | Writer::GoogleSheets | Writer::OpenDocument

Return an instance of a writer depending on the given options

rubocop:disable Metrics/MethodLength

Parameters:

  • options (Options)

    The supplied options.

  • runtime (Runtime)

    The current runtime.

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/csv_plus_plus/writer.rb', line 35

def self.writer(options, runtime)
  output_format = options.output_format
  case output_format
  when ::CSVPlusPlus::Options::OutputFormat::CSV then ::CSVPlusPlus::Writer::CSV.new(options, runtime)
  when ::CSVPlusPlus::Options::OutputFormat::Excel then ::CSVPlusPlus::Writer::Excel.new(options, runtime)
  when ::CSVPlusPlus::Options::OutputFormat::GoogleSheets then ::CSVPlusPlus::Writer::GoogleSheets.new(
    options,
    runtime
  )
  when ::CSVPlusPlus::Options::OutputFormat::OpenDocument then ::CSVPlusPlus::Writer::OpenDocument.new(
    options,
    runtime
  )
  else
    ::T.absurd(output_format)
  end
end