class Concurrent::Promises::ResolvableFuture
A Future which can be resolved by user.
Public Instance Methods
Evaluates the block and sets its result as future's value fulfilling, if the block raises an exception the future rejects with it. @yield [*args] to the block. @yieldreturn [Object] value @return [self]
# File lib/concurrent/promises.rb, line 1275 def evaluate_to(*args, &block) promise.evaluate_to(*args, block) end
Evaluates the block and sets its result as future's value fulfilling, if the block raises an exception the future rejects with it. @yield [*args] to the block. @yieldreturn [Object] value @return [self] @raise [Exception] also raise reason on rejection.
# File lib/concurrent/promises.rb, line 1285 def evaluate_to!(*args, &block) promise.evaluate_to(*args, block).wait! end
Makes the future fulfilled with `value`, which triggers all dependent futures.
@!macro promise.param.raise_on_reassign
# File lib/concurrent/promises.rb, line 1258 def fulfill(value, raise_on_reassign = true) promise.fulfill(value, raise_on_reassign) end
Makes the future rejected with `reason`, which triggers all dependent futures.
@!macro promise.param.raise_on_reassign
# File lib/concurrent/promises.rb, line 1266 def reject(reason, raise_on_reassign = true) promise.reject(reason, raise_on_reassign) end
Makes the future resolved with result of triplet `fulfilled?`, `value`, `reason`, which triggers all dependent futures.
@!macro promise.param.raise_on_reassign
# File lib/concurrent/promises.rb, line 1250 def resolve(fulfilled = true, value = nil, reason = nil, raise_on_reassign = true) resolve_with(fulfilled ? Fulfilled.new(value) : Rejected.new(reason), raise_on_reassign) end