class Vizsla::Timer

Attributes

events[R]

Public Class Methods

new() click to toggle source
# File lib/vizsla/timer.rb, line 7
def initialize
  @start_time = nil
  @stop_time = nil
end

Public Instance Methods

collect_events() click to toggle source
# File lib/vizsla/timer.rb, line 23
def collect_events
  @events = Recorder.events
end
elapsed() click to toggle source
# File lib/vizsla/timer.rb, line 27
def elapsed
  "#{(@stop_time - @start_time).round 2}s"
end
start!() click to toggle source
# File lib/vizsla/timer.rb, line 12
def start!
  @start_time = Time.now
  Recorder.start_recording
end
stop!() click to toggle source
# File lib/vizsla/timer.rb, line 17
def stop!
  collect_events
  Recorder.stop_recording
  @stop_time = Time.now
end