Class: ImageOptim::Timer

Inherits:
Object
  • Object
show all
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

Methods included from ElapsedTime

now

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

#elapsedObject



15
16
17
# File 'lib/image_optim/timer.rb', line 15

def elapsed
  now - @start
end

#leftObject Also known as: to_f



19
20
21
# File 'lib/image_optim/timer.rb', line 19

def left
  @seconds - elapsed
end