Module: BuildpackSupport::Component::WithTiming
- Included in:
- Downloads
- Defined in:
- lib/buildpack_support/component/with_timing.rb
Overview
A mixin for printing out a caption and timing when executing a block
Instance Method Summary collapse
-
#with_timing(caption) ⇒ Void
Wrap the execution of a block with timing information.
Instance Method Details
#with_timing(caption) ⇒ Void
Wrap the execution of a block with timing information
28 29 30 31 32 33 34 35 |
# File 'lib/buildpack_support/component/with_timing.rb', line 28 def with_timing() start_time = Time.now print " #{} " yield puts "(#{(Time.now - start_time).duration})" end |