Module: Concurrent::Obligation
- Includes:
- Dereferenceable
- Included in:
- Contract, Future, Promise, ScheduledTask
- Defined in:
- lib/concurrent/obligation.rb
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
-
#fulfilled? ⇒ Boolean
(also: #realized?)
Has the obligation been fulfilled?.
-
#pending? ⇒ Boolean
Is obligation completion still pending?.
-
#rejected? ⇒ Boolean
Has the obligation been rejected?.
- #value(timeout = nil) ⇒ Object
Methods included from Dereferenceable
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
13 14 15 |
# File 'lib/concurrent/obligation.rb', line 13 def reason @reason end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
12 13 14 |
# File 'lib/concurrent/obligation.rb', line 12 def state @state end |
Instance Method Details
#fulfilled? ⇒ Boolean Also known as: realized?
Has the obligation been fulfilled?
17 |
# File 'lib/concurrent/obligation.rb', line 17 def fulfilled?() return(@state == :fulfilled); end |
#pending? ⇒ Boolean
Is obligation completion still pending?
26 |
# File 'lib/concurrent/obligation.rb', line 26 def pending?() return(@state == :pending); end |
#rejected? ⇒ Boolean
Has the obligation been rejected?
22 |
# File 'lib/concurrent/obligation.rb', line 22 def rejected?() return(@state == :rejected); end |
#value(timeout = nil) ⇒ Object
28 29 30 31 |
# File 'lib/concurrent/obligation.rb', line 28 def value(timeout = nil) event.wait(timeout) unless timeout == 0 || @state != :pending super() end |