Class: Burner::Library::Deserialize::Csv

Inherits:
JobWithRegister show all
Defined in:
lib/burner/library/deserialize/csv.rb

Overview

Take a CSV string and de-serialize into object(s).

Expected Payload input: nothing. Payload output: an array of arrays. Each inner array represents one data row.

Constant Summary

Constants inherited from JobWithRegister

JobWithRegister::BLANK

Instance Attribute Summary

Attributes inherited from JobWithRegister

#register

Attributes inherited from Job

#name

Instance Method Summary collapse

Methods inherited from JobWithRegister

#initialize

Methods inherited from Job

#initialize

Methods included from Util::Arrayable

#array

Constructor Details

This class inherits a constructor from Burner::JobWithRegister

Instance Method Details

#perform(_output, payload) ⇒ Object

This currently only supports returning an array of arrays, including the header row. In the future this could be extended to offer more customizable options, such as making it return an array of hashes with the columns mapped, etc.)



21
22
23
# File 'lib/burner/library/deserialize/csv.rb', line 21

def perform(_output, payload)
  payload[register] = CSV.new(payload[register], headers: false).to_a
end