Class: WaitFor::Timer

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Timer

A new instance of Timer.

Parameters:

  • options (Hash)

    for Timer configuration such as ‘:seconds`, `:minutes`, `:exception` and `:message`



7
8
9
10
# File 'lib/waitfor/timer.rb', line 7

def initialize( options )
  @config = WaitFor::Settings::Configuration.new( options )
  @start_time = Time.now
end

Instance Method Details

#out_of_time?Boolean

Returns whether the elapsed time has surpassed the allotted time

Returns:

  • (Boolean)

    of elapsed time is greater or equal to the set number of seconds

Raises:



16
17
18
19
# File 'lib/waitfor/timer.rb', line 16

def out_of_time?
  raise_exception if timed_out?
  false
end