Class: ThreadExecutor::Future

Inherits:
Object
  • Object
show all
Defined in:
lib/thread_executor/future.rb

Overview

Proxies access to a Future object.

This protects the user from doing the “wrong thing” with a Promise.

Instance Method Summary collapse

Constructor Details

#initialize(promise) ⇒ Future

Returns a new instance of Future.



36
37
38
# File 'lib/thread_executor/future.rb', line 36

def initialize(promise)
  @promise = promise
end

Instance Method Details

#valueObject

Block until a value is ready.

If an Exception was raised instead of producing a value it is rethrown.

This call is proxied to Promise#value.



46
47
48
# File 'lib/thread_executor/future.rb', line 46

def value
  @promise.value
end