Class: Pal::Operation::BaseExportHandler

Inherits:
Object
  • Object
show all
Includes:
Configuration, Log
Defined in:
lib/pal/operation/exporter.rb

Direct Known Subclasses

CsvExporterImpl, TableExporterImpl

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Log

#log_debug, #log_error, #log_info, #log_warn

Methods included from Configuration

#config, #register_config

Constructor Details

#initialize(settings) ⇒ BaseExportHandler

Returns a new instance of BaseExportHandler.

Parameters:

  • settings (Hash)


123
124
125
# File 'lib/pal/operation/exporter.rb', line 123

def initialize(settings)
  @settings = settings
end

Instance Attribute Details

#settingsHash

Returns settings.

Returns:

  • (Hash)

    settings



120
121
122
# File 'lib/pal/operation/exporter.rb', line 120

def settings
  @settings
end

Instance Method Details

#run_export(rows, columns) ⇒ Object

Extract values, call export.

Parameters:

  • rows (Array)
  • columns (Hash)


130
131
132
133
134
135
136
137
# File 'lib/pal/operation/exporter.rb', line 130

def run_export(rows, columns)
  if rows.empty?
    Pal.logger.warn("No results were found, will not export.")
    return
  end

  _export(rows, columns)
end