Class: Concurrent::Promises::ResolvableFuture
- Inherits:
-
Future
- Object
- Synchronization::Object
- AbstractEventFuture
- Future
- Concurrent::Promises::ResolvableFuture
- Includes:
- Resolvable
- Defined in:
- lib/concurrent/edge/promises.rb
Overview
A Future which can be resolved by user.
Constant Summary
Instance Method Summary (collapse)
-
- (self) evaluate_to(*args) {|*args| ... }
Evaluates the block and sets its result as future's value fulfilling, if the block raises an exception the future rejects with it.
-
- (self) evaluate_to!(*args) {|*args| ... }
Evaluates the block and sets its result as future's value fulfilling, if the block raises an exception the future rejects with it.
-
- (self, false) fulfill(value, raise_on_reassign = true)
Makes the future fulfilled with
value
, which triggers all dependent futures. -
- (self, false) reject(reason, raise_on_reassign = true)
Makes the future rejected with
reason
, which triggers all dependent futures. -
- (self, false) resolve(fulfilled = true, value = nil, reason = nil, raise_on_reassign = true)
Makes the future resolved with result of triplet
fulfilled?
,value
,reason
, which triggers all dependent futures. -
- (Future) with_hidden_resolvable
Creates new future wrapping receiver, effectively hiding the resolve method and similar.
Instance Method Details
- (self) evaluate_to(*args) {|*args| ... }
Evaluates the block and sets its result as future's value fulfilling, if the block raises an exception the future rejects with it.
1300 1301 1302 1303 |
# File 'lib/concurrent/edge/promises.rb', line 1300 def evaluate_to(*args, &block) # FIXME (pitr-ch 13-Jun-2016): add raise_on_reassign promise.evaluate_to(*args, block) end |
- (self) evaluate_to!(*args) {|*args| ... }
Evaluates the block and sets its result as future's value fulfilling, if the block raises an exception the future rejects with it.
1311 1312 1313 |
# File 'lib/concurrent/edge/promises.rb', line 1311 def evaluate_to!(*args, &block) promise.evaluate_to!(*args, block) end |
- (self, false) fulfill(value, raise_on_reassign = true)
Makes the future fulfilled with value
,
which triggers all dependent futures.
1283 1284 1285 |
# File 'lib/concurrent/edge/promises.rb', line 1283 def fulfill(value, raise_on_reassign = true) promise.fulfill(value, raise_on_reassign) end |
- (self, false) reject(reason, raise_on_reassign = true)
Makes the future rejected with reason
,
which triggers all dependent futures.
1291 1292 1293 |
# File 'lib/concurrent/edge/promises.rb', line 1291 def reject(reason, raise_on_reassign = true) promise.reject(reason, raise_on_reassign) end |
- (self, false) resolve(fulfilled = true, value = nil, reason = nil, raise_on_reassign = true)
Makes the future resolved with result of triplet fulfilled?
, value
, reason
,
which triggers all dependent futures.
1275 1276 1277 |
# File 'lib/concurrent/edge/promises.rb', line 1275 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 |
- (Future) with_hidden_resolvable
Creates new future wrapping receiver, effectively hiding the resolve method and similar.
1318 1319 1320 |
# File 'lib/concurrent/edge/promises.rb', line 1318 def with_hidden_resolvable @with_hidden_resolvable ||= FutureWrapperPromise.new_blocked_by1(self, @DefaultExecutor).future end |