Class: Dry::Effects::Providers::Async
- Inherits:
-
Object
- Object
- Dry::Effects::Providers::Async
- Defined in:
- lib/dry/effects/providers/async.rb
Instance Attribute Summary collapse
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
- #async(block) ⇒ Object
- #await(task) ⇒ Object
-
#call ⇒ Object
private
Yield the block with the handler installed.
Instance Attribute Details
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
11 12 13 |
# File 'lib/dry/effects/providers/async.rb', line 11 def stack @stack end |
Instance Method Details
#async(block) ⇒ Object
13 14 15 |
# File 'lib/dry/effects/providers/async.rb', line 13 def async(block) @tasks[block] = block end |
#await(task) ⇒ Object
17 18 19 |
# File 'lib/dry/effects/providers/async.rb', line 17 def await(task) Frame.spawn_fiber(stack, &@tasks.delete(task)) end |
#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
24 25 26 27 28 |
# File 'lib/dry/effects/providers/async.rb', line 24 def call @stack = Frame.stack super nil end |