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_push, #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]
831 832 833 |
# File 'lib/concurrent/edge/future.rb', line 831 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]
861 862 863 |
# File 'lib/concurrent/edge/future.rb', line 861 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]
868 869 870 |
# File 'lib/concurrent/edge/future.rb', line 868 def evaluate_to!(*args, &block) promise.evaluate_to!(*args, block) end |
#fail(reason = StandardError.new) ⇒ Object
Fail the future with reason return [self]
849 850 851 |
# File 'lib/concurrent/edge/future.rb', line 849 def fail(reason = StandardError.new) promise.fail(reason) end |
#hide_completable ⇒ Object
872 873 874 |
# File 'lib/concurrent/edge/future.rb', line 872 def hide_completable FutureWrapperPromise.new(self, @DefaultExecutor).future end |
#success(value) ⇒ Object
Complete the future with value return [self]
837 838 839 |
# File 'lib/concurrent/edge/future.rb', line 837 def success(value) promise.success(value) end |
#try_fail(reason = StandardError.new) ⇒ Object
Try to fail the future with reason return [self]
855 856 857 |
# File 'lib/concurrent/edge/future.rb', line 855 def try_fail(reason = StandardError.new) promise.try_fail(reason) end |
#try_success(value) ⇒ Object
Try to complete the future with value return [self]
843 844 845 |
# File 'lib/concurrent/edge/future.rb', line 843 def try_success(value) promise.try_success(value) end |