Class: Cogger::Time::Span
- Inherits:
-
Object
- Object
- Cogger::Time::Span
- Defined in:
- lib/cogger/time/span.rb
Overview
Measures duration of a process with nanosecond precision.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(clock = Clock, unit: Unit, range: RANGE) ⇒ Span
constructor
A new instance of Span.
Constructor Details
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/cogger/time/span.rb', line 13 def call start = current result = yield span = current - start [result, duration(span), unit.call(span)] end |