Class: IntervalTimer

Inherits:
Object
  • Object
show all
Defined in:
lib/interval_timer/version.rb,
lib/interval_timer/interval_timer.rb

Constant Summary collapse

VERSION =
'0.0.3'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startedObject



2
3
4
5
6
# File 'lib/interval_timer/interval_timer.rb', line 2

def self.started
  timer = new
  timer.start
  timer
end

Instance Method Details

#check_in(message = nil) ⇒ Object Also known as: mark



14
15
16
17
18
# File 'lib/interval_timer/interval_timer.rb', line 14

def check_in(message = nil)
  check_in = build_check_in(message)
  check_ins.push(check_in)
  check_in
end

#check_insObject



28
29
30
# File 'lib/interval_timer/interval_timer.rb', line 28

def check_ins
  @check_ins ||= []
end

#report(message = nil) ⇒ Object



21
22
23
24
25
26
# File 'lib/interval_timer/interval_timer.rb', line 21

def report(message = nil)
  [
    report_header(message).join("\n"),
    report_body.join("\n")
  ].join("\n")
end

#startObject



8
9
10
11
12
# File 'lib/interval_timer/interval_timer.rb', line 8

def start
  raise "Already started" if @start_time

  @start_time = Time.now
end