Reference documentation and code samples for the Cloud Firestore API class Google::Cloud::Firestore::Promise::Future.
Future
A Future object represents a value which will become available in future. May reject with a reason instead, e.g. when the tasks raises an exception.
Inherits
- Object
Methods
#fulfilled?
def fulfilled?() -> Boolean
Is it in fulfilled state?
- (Boolean)
#initialize
def initialize(future) -> Future
Initialize the future object
- (Future) — a new instance of Future
#reason
def reason(timeout = nil, timeout_value = nil) -> Object, timeout_value
Returns reason of future's rejection.
- (Object, timeout_value) — the reason, or timeout_value on timeout, or nil on fulfillment.
#rejected?
def rejected?() -> Boolean
Is it in rejected state?
- (Boolean)
#rescue
def rescue(*args, &task) -> Future
Chains the task to be executed synchronously on executor after it rejects. Does not run the task if it fulfills. It will resolve though, triggering any dependent futures.
- (reason, *args) — to the task.
- (Future)
#then
def then(*args, &task) -> Future
Chains the task to be executed synchronously after it fulfills. Does not run the task if it rejects. It will resolve though, triggering any dependent futures.
- (reason, *args) — to the task.
- (Future)
#value
def value(timeout = nil, timeout_value = nil) -> Object, nil, timeout_value
Method waits for the timeout duration and return the value of the future if fulfilled, timeout value in case of timeout and nil in case of rejection.
- timeout (Integer) — the maximum time in seconds to wait
- timeout_value (Object) — a value returned by the method when it times out
- (Object, nil, timeout_value) — the value of the Future when fulfilled, timeout_value on timeout, nil on rejection.
#wait!
def wait!(timeout = nil)
Method waits for the timeout duration and raise exception on rejection
- timeout (Integer) — the maximum time in seconds to wait