Class: Tap::Joins::Sync::Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/tap/joins/sync.rb

Overview

Callbacks are set as the join for each input to a Sync join, and allow the result of an input to be stored in the correct slot of the results array.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(join, index) ⇒ Callback

Returns a new instance of Callback.



84
85
86
87
# File 'lib/tap/joins/sync.rb', line 84

def initialize(join, index)
  @join = join
  @index = index
end

Instance Attribute Details

#indexObject (readonly)

The results index where result should be stored.



82
83
84
# File 'lib/tap/joins/sync.rb', line 82

def index
  @index
end

#joinObject (readonly)

A backreference to the parent Sync join.



79
80
81
# File 'lib/tap/joins/sync.rb', line 79

def join
  @join
end

Instance Method Details

#call(result) ⇒ Object

Calls back to a Sync join to store the result at index.



90
91
92
# File 'lib/tap/joins/sync.rb', line 90

def call(result)
  join.call(result, index)
end