Class: Cabin::Metrics::Timer
- Defined in:
- lib/cabin/metrics/timer.rb
Defined Under Namespace
Classes: TimerContext
Instance Method Summary collapse
Methods inherited from Histogram
#initialize, #record, #to_hash, #value
Methods included from Cabin::Metric
Methods included from Publisher
Methods included from Inspectable
Constructor Details
This class inherits a constructor from Cabin::Metrics::Histogram
Instance Method Details
#time(&block) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cabin/metrics/timer.rb', line 11 def time(&block) return time_block(&block) if block_given? # Return an object we can .stop # Call record(...) when we stop. return TimerContext.new { |duration| record(duration) } end |