Class: Temporal::Testing::FutureRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/temporal/testing/future_registry.rb

Instance Method Summary collapse

Constructor Details

#initializeFutureRegistry

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