Create a new future.
Create a new promise.
Create a new future
Examples:
Evaluate an operation in another thread
x = future { 3 + 3 }
Yields:
A block to be optimistically evaluated in another thread
Yield Returns:
The return value of the block will be the evaluated value of the future.
Returns:
63 64 65
# File 'lib/future.rb', line 63 def future(&block) Future.new(block) end
Create a new promise
Lazily evaluate an arithmetic operation
x = promise { 3 + 3 }
A block to be lazily evaluated
The return value of the block will be the lazily evaluated value of the promise.
81 82 83
# File 'lib/promise.rb', line 81 def promise(&block) Promise.new(block) end