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.



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

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

Instance Attribute Details

#indexObject (readonly)

The results index where result should be stored.



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

def index
  @index
end

#joinObject (readonly)

A backreference to the parent Sync join.



77
78
79
# File 'lib/tap/joins/sync.rb', line 77

def join
  @join
end

Instance Method Details

#call(result) ⇒ Object

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



88
89
90
# File 'lib/tap/joins/sync.rb', line 88

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