Class: Mutant::Timer::Deadline Private
- Inherits:
-
Object
- Object
- Mutant::Timer::Deadline
- Defined in:
- lib/mutant/timer.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Defined Under Namespace
Instance Method Summary collapse
-
#expired? ⇒ Boolean
private
Test if deadline is expired.
-
#initialize(*arguments) ⇒ Deadline
constructor
private
A new instance of Deadline.
-
#status ⇒ Status
private
Capture a deadline status.
-
#time_left ⇒ Float?
private
Probe the time left.
Constructor Details
#initialize(*arguments) ⇒ Deadline
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Deadline.
17 18 19 20 |
# File 'lib/mutant/timer.rb', line 17 def initialize(*arguments) super(*arguments) @start_at = timer.now end |
Instance Method Details
#expired? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test if deadline is expired
25 26 27 |
# File 'lib/mutant/timer.rb', line 25 def expired? time_left <= 0 end |
#status ⇒ Status
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Capture a deadline status
42 43 44 |
# File 'lib/mutant/timer.rb', line 42 def status Status.new(time_left) end |
#time_left ⇒ Float?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Probe the time left
49 50 51 |
# File 'lib/mutant/timer.rb', line 49 def time_left allowed_time - (timer.now - @start_at) end |