Class: Dry::Effects::Providers::Parallel
- Inherits:
-
Object
- Object
- Dry::Effects::Providers::Parallel
- Defined in:
- lib/dry/effects/providers/parallel.rb
Instance Attribute Summary collapse
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
-
#call ⇒ Object
private
Yield the block with the handler installed.
- #join(xs) ⇒ Object
- #par ⇒ Object
Instance Attribute Details
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
13 14 15 |
# File 'lib/dry/effects/providers/parallel.rb', line 13 def stack @stack end |
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Yield the block with the handler installed
31 32 33 34 |
# File 'lib/dry/effects/providers/parallel.rb', line 31 def call @stack = Frame.stack yield end |
#join(xs) ⇒ Object
24 25 26 |
# File 'lib/dry/effects/providers/parallel.rb', line 24 def join(xs) xs.map(&:value!) end |
#par ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/dry/effects/providers/parallel.rb', line 15 def par stack = self.stack.dup proc do |&block| ::Concurrent::Promise.execute(executor: executor) do Frame.spawn_fiber(stack, &block) end end end |