Class: Suture::Util::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/suture/util/timer.rb

Instance Method Summary collapse

Constructor Details

#initialize(limit_in_seconds) ⇒ Timer

Returns a new instance of Timer.



5
6
7
8
# File 'lib/suture/util/timer.rb', line 5

def initialize(limit_in_seconds)
  @started_at = Time.new
  @limit_in_seconds = limit_in_seconds
end

Instance Method Details

#time_up?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/suture/util/timer.rb', line 10

def time_up?
  Time.new >= (@started_at + @limit_in_seconds)
end