Class: ArcFurnace::HashSource

Inherits:
EnumeratorSource show all
Defined in:
lib/arc-furnace/hash_source.rb

Instance Attribute Summary collapse

Attributes inherited from EnumeratorSource

#value

Attributes inherited from Node

#error_handler, #node_id, #params

Instance Method Summary collapse

Methods inherited from EnumeratorSource

#advance, #empty?, #preprocess

Methods inherited from Source

#advance, #close, #empty?, #finalize, #prepare, #row, #value

Constructor Details

#initialize(hashes:) ⇒ HashSource

expects an array of hashes



9
10
11
12
# File 'lib/arc-furnace/hash_source.rb', line 9

def initialize(hashes:)
  @hashes = hashes
  super()
end

Instance Attribute Details

#hashesObject (readonly)

Returns the value of attribute hashes.



6
7
8
# File 'lib/arc-furnace/hash_source.rb', line 6

def hashes
  @hashes
end

Instance Method Details

#build_enumeratorObject



14
15
16
17
18
# File 'lib/arc-furnace/hash_source.rb', line 14

def build_enumerator
  Enumerator.new do |yielder|
    hashes.each { |hash| yielder.yield(hash) }
  end
end