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.
26 27 28 29 |
# File 'lib/mutant/timer.rb', line 26 def initialize(*arguments) super @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
34 35 36 |
# File 'lib/mutant/timer.rb', line 34 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
51 52 53 |
# File 'lib/mutant/timer.rb', line 51 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
58 59 60 |
# File 'lib/mutant/timer.rb', line 58 def time_left allowed_time - (timer.now - @start_at) end |