Class: Garcon::Condition::Result
Instance Attribute Summary collapse
-
#remaining_time ⇒ Object
readonly
Returns the value of attribute remaining_time.
Instance Method Summary collapse
-
#initialize(remaining_time) ⇒ Result
constructor
A new instance of Result.
-
#timed_out? ⇒ Boolean
Returns true if current thread has been waken up due to a timeout, otherwise false.
-
#woken_up? ⇒ Boolean
(also: #can_wait?)
Returns true if current thread has been waken up by a #signal or a #broadcast call, otherwise false.
Constructor Details
#initialize(remaining_time) ⇒ Result
Returns a new instance of Result.
36 37 38 |
# File 'lib/garcon/task/condition.rb', line 36 def initialize(remaining_time) @remaining_time = remaining_time end |
Instance Attribute Details
#remaining_time ⇒ Object (readonly)
Returns the value of attribute remaining_time.
40 41 42 |
# File 'lib/garcon/task/condition.rb', line 40 def remaining_time @remaining_time end |
Instance Method Details
#timed_out? ⇒ Boolean
Returns true if current thread has been waken up due to a timeout, otherwise false.
52 53 54 |
# File 'lib/garcon/task/condition.rb', line 52 def timed_out? @remaining_time != nil && @remaining_time <= 0 end |
#woken_up? ⇒ Boolean Also known as: can_wait?
Returns true if current thread has been waken up by a #signal or a #broadcast call, otherwise false.
45 46 47 |
# File 'lib/garcon/task/condition.rb', line 45 def woken_up? @remaining_time.nil? || @remaining_time > 0 end |