Class: Overnight::Timer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#end_timeObject (readonly)

Returns the value of attribute end_time.



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

def end_time
  @end_time
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



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

def start_time
  @start_time
end

Instance Method Details

#elapsed_timeObject



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

def elapsed_time
  @end_time - @start_time
end

#startObject



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

def start
  @start_time ||= Time.now
  self
end

#stopObject



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

def stop
  @end_time ||= Time.now
  self
end