Class: FutureProof::Future
- Inherits:
-
Object
- Object
- FutureProof::Future
- Defined in:
- lib/future_proof/future.rb
Instance Method Summary collapse
- #call(*args) ⇒ Object
- #complete? ⇒ Boolean
-
#initialize(&block) ⇒ Future
constructor
A new instance of Future.
- #value(*args) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Future
Returns a new instance of Future.
3 4 5 |
# File 'lib/future_proof/future.rb', line 3 def initialize(&block) @block = block end |
Instance Method Details
#call(*args) ⇒ Object
7 8 9 |
# File 'lib/future_proof/future.rb', line 7 def call(*args) thread(*args) end |
#complete? ⇒ Boolean
15 16 17 |
# File 'lib/future_proof/future.rb', line 15 def complete? !thread.alive? end |
#value(*args) ⇒ Object
11 12 13 |
# File 'lib/future_proof/future.rb', line 11 def value(*args) thread(*args).value end |