Class: Tap::Support::Joins::Fork

Inherits:
Tap::Support::Join show all
Defined in:
lib/tap/support/joins/fork.rb

Overview

A Fork join passes the results of source to each of the targets.

Constant Summary

Constants inherited from Tap::Support::Join

Tap::Support::Join::FLAGS, Tap::Support::Join::SHORT_FLAGS

Instance Method Summary collapse

Methods inherited from Tap::Support::Join

#initialize, #inspect, join, #name, #options

Constructor Details

This class inherits a constructor from Tap::Support::Join

Instance Method Details

#join(source, targets) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/tap/support/joins/fork.rb', line 7

def join(source, targets)
  complete(source) do |_result|
    targets.each do |target| 
      yield(_result) if block_given?
      enq(target, _result)
    end
  end
end