Class: Chicago::Flow::ArraySink

Inherits:
Sink show all
Defined in:
lib/chicago/flow/array_sink.rb

Instance Attribute Summary collapse

Attributes inherited from PipelineEndpoint

#fields

Instance Method Summary collapse

Methods inherited from Sink

#close, #constant_values, #open

Methods inherited from PipelineEndpoint

#has_defined_fields?

Constructor Details

#initialize(fields = []) ⇒ ArraySink

Returns a new instance of ArraySink.



6
7
8
9
# File 'lib/chicago/flow/array_sink.rb', line 6

def initialize(fields=[])
  @fields = [fields].flatten
  @data = []
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/chicago/flow/array_sink.rb', line 4

def data
  @data
end

Instance Method Details

#<<(row) ⇒ Object



11
12
13
# File 'lib/chicago/flow/array_sink.rb', line 11

def <<(row)
  @data << row.merge(constant_values)
end