Class: Timecrunch::Timer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(times, *notifiers) ⇒ Timer

Returns a new instance of Timer.



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

def initialize(times, *notifiers)
  @times = times
  @notifiers = notifiers
end

Instance Attribute Details

#notifiersObject

Returns the value of attribute notifiers.



3
4
5
# File 'lib/timecrunch/timer.rb', line 3

def notifiers
  @notifiers
end

Instance Method Details

#start!Object



10
11
12
13
# File 'lib/timecrunch/timer.rb', line 10

def start!
  sleep(total_time)
  @notifiers.each { |notifier| notifier.notify! }
end