Class: ThreadExecutor::Future
- Inherits:
-
Object
- Object
- ThreadExecutor::Future
- 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
-
#initialize(promise) ⇒ Future
constructor
A new instance of Future.
-
#value ⇒ Object
Block until a value is ready.
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
#value ⇒ Object
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 |