Module: TickTock

Defined in:
lib/tick-tock.rb,
lib/tick-tock/duration.rb,
lib/tick-tock/formatter.rb

Defined Under Namespace

Classes: Duration, Formatter

Class Method Summary collapse

Class Method Details

.freshObject



6
7
8
# File 'lib/tick-tock.rb', line 6

def self.fresh
  TickTock::Duration.new
end

.time(duration = nil) ⇒ Object



10
11
12
13
14
15
# File 'lib/tick-tock.rb', line 10

def self.time(duration = nil)
  start = Time.now
  yield
  this_timing = TickTock::Duration.from_times(start, Time.now)
  duration.nil? ? this_timing : duration + this_timing
end