Class: Temporal::Testing::FutureRegistry
- Inherits:
-
Object
- Object
- Temporal::Testing::FutureRegistry
- Defined in:
- lib/temporal/testing/future_registry.rb
Instance Method Summary collapse
- #complete(token, result) ⇒ Object
- #fail(token, error) ⇒ Object
-
#initialize ⇒ FutureRegistry
constructor
A new instance of FutureRegistry.
- #register(token, future) ⇒ Object
Constructor Details
#initialize ⇒ FutureRegistry
Returns a new instance of FutureRegistry.
4 5 6 |
# File 'lib/temporal/testing/future_registry.rb', line 4 def initialize @store = {} end |
Instance Method Details
#complete(token, result) ⇒ Object
14 15 16 |
# File 'lib/temporal/testing/future_registry.rb', line 14 def complete(token, result) store[token].set(result) end |
#fail(token, error) ⇒ Object
18 19 20 |
# File 'lib/temporal/testing/future_registry.rb', line 18 def fail(token, error) store[token].fail(error) end |
#register(token, future) ⇒ Object
8 9 10 11 12 |
# File 'lib/temporal/testing/future_registry.rb', line 8 def register(token, future) raise 'already registered' if store.key?(token) store[token] = future end |