Class: Burner::Library::Serialize::Csv
- Inherits:
-
JobWithRegister
- Object
- Job
- JobWithRegister
- Burner::Library::Serialize::Csv
- Defined in:
- lib/burner/library/serialize/csv.rb
Overview
Constant Summary
Constants inherited from JobWithRegister
Instance Attribute Summary collapse
-
#byte_order_mark ⇒ Object
readonly
Returns the value of attribute byte_order_mark.
Attributes inherited from JobWithRegister
Attributes inherited from Job
Instance Method Summary collapse
-
#initialize(byte_order_mark: nil, name: '', register: DEFAULT_REGISTER) ⇒ Csv
constructor
A new instance of Csv.
- #perform(_output, payload) ⇒ Object
Methods included from Util::Arrayable
Constructor Details
#initialize(byte_order_mark: nil, name: '', register: DEFAULT_REGISTER) ⇒ Csv
Returns a new instance of Csv.
21 22 23 24 25 26 27 |
# File 'lib/burner/library/serialize/csv.rb', line 21 def initialize(byte_order_mark: nil, name: '', register: DEFAULT_REGISTER) super(name: name, register: register) @byte_order_mark = Modeling::ByteOrderMark.resolve(byte_order_mark) freeze end |
Instance Attribute Details
#byte_order_mark ⇒ Object (readonly)
Returns the value of attribute byte_order_mark.
19 20 21 |
# File 'lib/burner/library/serialize/csv.rb', line 19 def byte_order_mark @byte_order_mark end |
Instance Method Details
#perform(_output, payload) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/burner/library/serialize/csv.rb', line 29 def perform(_output, payload) serialized_rows = CSV.generate() do |csv| array(payload[register]).each do |row| csv << row end end payload[register] = "#{byte_order_mark}#{serialized_rows}" end |