Class: Pal::Operation::CsvExporterImpl

Inherits:
BaseExportHandler show all
Includes:
FileExportable
Defined in:
lib/pal/operation/exporter.rb

Instance Attribute Summary

Attributes inherited from BaseExportHandler

#settings

Instance Method Summary collapse

Methods included from FileExportable

#write_to_file

Methods inherited from BaseExportHandler

#initialize, #run_export

Methods included from Log

#log_debug, #log_error, #log_info, #log_warn

Methods included from Configuration

#config, #register_config

Constructor Details

This class inherits a constructor from Pal::Operation::BaseExportHandler

Instance Method Details

#_export(rows, column_headers) ⇒ Object

Parameters:

  • rows (Array)
  • column_headers (Hash)


154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/pal/operation/exporter.rb', line 154

def _export(rows, column_headers)
  file_contents = []
  file_contents << column_headers.keys.join(",")

  rows.each do |row|
    file_contents << row.join(",")
  end

  write_to_file(
    @settings["output_dir"], @settings["file_name"] || "pal", "csv", file_contents.join("\n")
  )
end