Class: Stopwatch

Inherits:
Object
  • Object
show all
Defined in:
lib/kale/stopwatch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#end_timeObject

Returns the value of attribute end_time.



3
4
5
# File 'lib/kale/stopwatch.rb', line 3

def end_time
  @end_time
end

#start_timeObject

Returns the value of attribute start_time.



3
4
5
# File 'lib/kale/stopwatch.rb', line 3

def start_time
  @start_time
end

Instance Method Details

#elapsed_timeObject



13
14
15
# File 'lib/kale/stopwatch.rb', line 13

def elapsed_time
  self.end_time - self.start_time
end

#startObject



5
6
7
# File 'lib/kale/stopwatch.rb', line 5

def start
  self.start_time = Time.now
end

#stopObject



9
10
11
# File 'lib/kale/stopwatch.rb', line 9

def stop
  self.end_time = Time.now
end