Class: Garcon::Condition::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/garcon/task/condition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_timeObject (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.

Returns:

  • (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.

Returns:

  • (Boolean)

    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