Class: Concurrent::Edge::CompletableFuture
Overview
A Future which can be completed by user.
Instance Method Summary collapse
-
#complete(success, value, reason, raise_on_reassign = true) ⇒ Object
Complete the future with triplet od ‘success`, `value`, `reason` `raise` if already completed return [self].
-
#evaluate_to(*args, &block) ⇒ Object
Evaluate the future to value if there is an exception the future fails with it return [self].
-
#evaluate_to!(*args, &block) ⇒ Object
Evaluate the future to value if there is an exception the future fails with it return [self].
-
#fail(reason = StandardError.new) ⇒ Object
Fail the future with reason return [self].
- #hide_completable ⇒ Object
-
#success(value) ⇒ Object
Complete the future with value return [self].
-
#try_fail(reason = StandardError.new) ⇒ Object
Try to fail the future with reason return [self].
-
#try_success(value) ⇒ Object
Try to complete the future with value return [self].
Methods inherited from Future
#any, #chain_completable, #delay, #exception, #failed?, #flat, #fulfilled?, #on_failure, #on_failure!, #on_success, #on_success!, #reason, #rejected?, #rescue, #result, #schedule, #state, #success?, #then, #then_ask, #then_put, #then_select, #value, #value!, #wait!, #with_default_executor, #zip
Methods inherited from Event
#chain, #chain_completable, #completed?, #default_executor, #delay, #initialize, #inspect, #on_completion, #on_completion!, #pending?, #set, #state, #then_select, #to_s, #unscheduled?, #wait, #with_default_executor, #zip
Constructor Details
This class inherits a constructor from Concurrent::Edge::Event
Instance Method Details
#complete(success, value, reason, raise_on_reassign = true) ⇒ Object
Complete the future with triplet od ‘success`, `value`, `reason` `raise` if already completed return [self]
836 837 838 |
# File 'lib/concurrent/edge/future.rb', line 836 def complete(success, value, reason, raise_on_reassign = true) complete_with(success ? Success.new(value) : Failed.new(reason), raise_on_reassign) end |
#evaluate_to(*args, &block) ⇒ Object
Evaluate the future to value if there is an exception the future fails with it return [self]
866 867 868 |
# File 'lib/concurrent/edge/future.rb', line 866 def evaluate_to(*args, &block) promise.evaluate_to(*args, block) end |
#evaluate_to!(*args, &block) ⇒ Object
Evaluate the future to value if there is an exception the future fails with it return [self]
873 874 875 |
# File 'lib/concurrent/edge/future.rb', line 873 def evaluate_to!(*args, &block) promise.evaluate_to!(*args, block) end |
#fail(reason = StandardError.new) ⇒ Object
Fail the future with reason return [self]
854 855 856 |
# File 'lib/concurrent/edge/future.rb', line 854 def fail(reason = StandardError.new) promise.fail(reason) end |
#hide_completable ⇒ Object
877 878 879 |
# File 'lib/concurrent/edge/future.rb', line 877 def hide_completable FutureWrapperPromise.new(self, @DefaultExecutor).future end |
#success(value) ⇒ Object
Complete the future with value return [self]
842 843 844 |
# File 'lib/concurrent/edge/future.rb', line 842 def success(value) promise.success(value) end |
#try_fail(reason = StandardError.new) ⇒ Object
Try to fail the future with reason return [self]
860 861 862 |
# File 'lib/concurrent/edge/future.rb', line 860 def try_fail(reason = StandardError.new) promise.try_fail(reason) end |
#try_success(value) ⇒ Object
Try to complete the future with value return [self]
848 849 850 |
# File 'lib/concurrent/edge/future.rb', line 848 def try_success(value) promise.try_success(value) end |