Class: Rack::Stats::Timer
- Inherits:
-
Object
- Object
- Rack::Stats::Timer
- Defined in:
- lib/rack/stats/timer.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
Instance Method Summary collapse
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
13 14 15 |
# File 'lib/rack/stats/timer.rb', line 13 def duration @duration end |
Instance Method Details
#time(&blk) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rack/stats/timer.rb', line 15 def time(&blk) t0 = Time.now.nsec r = blk.call @duration = Duration.new(Time.now.nsec - t0) r end |