Module: Timeit

Extended by:
Timeit
Included in:
Timeit
Defined in:
lib/timeit.rb,
lib/timeit/version.rb

Defined Under Namespace

Classes: Timer

Constant Summary collapse

VERSION =
"0.0.4"

Instance Method Summary collapse

Instance Method Details

#ti(autostart = true) {|t| ... } ⇒ Object

Yields:

  • (t)


73
74
75
76
77
78
79
# File 'lib/timeit.rb', line 73

def ti(autostart = true, &block)
  t = Timer.new
  t.start if autostart
  yield t
  t.stop
  t
end