Class: ImageOptim::Timer
- Inherits:
-
Object
- Object
- ImageOptim::Timer
- Includes:
- ElapsedTime
- Defined in:
- lib/image_optim/timer.rb
Overview
Hold start time and timeout
Constant Summary
Constants included from ElapsedTime
ElapsedTime::CLOCK_ID, ElapsedTime::CLOCK_NAME
Instance Method Summary collapse
- #elapsed ⇒ Object
-
#initialize(seconds) ⇒ Timer
constructor
A new instance of Timer.
- #left ⇒ Object (also: #to_f)
Methods included from ElapsedTime
Constructor Details
#initialize(seconds) ⇒ Timer
Returns a new instance of Timer.
10 11 12 13 |
# File 'lib/image_optim/timer.rb', line 10 def initialize(seconds) @start = now @seconds = seconds end |
Instance Method Details
#elapsed ⇒ Object
15 16 17 |
# File 'lib/image_optim/timer.rb', line 15 def elapsed now - @start end |
#left ⇒ Object Also known as: to_f
19 20 21 |
# File 'lib/image_optim/timer.rb', line 19 def left @seconds - elapsed end |