class Monotonic::Timer
Public Class Methods
time(&block)
click to toggle source
# File lib/Monotonic/Timer.rb, line 11 def time(&block) timer = Timer.new timer.time(&block) end
Public Instance Methods
start()
click to toggle source
# File lib/Monotonic/Timer.rb, line 18 def start @finish_time = nil @start_time = Monotonic::Time.now end
stop()
click to toggle source
# File lib/Monotonic/Timer.rb, line 23 def stop @finish_time = Monotonic::Time.now end
time() { |self| ... }
click to toggle source
# File lib/Monotonic/Timer.rb, line 35 def time start yield self ensure stop total_time end
total_time()
click to toggle source
# File lib/Monotonic/Timer.rb, line 27 def total_time if @finish_time @finish_time - @start_time else Monotonic::Time.now - @start_time end end