diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-17 15:53:22 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-17 16:03:56 -0700 |
commit | cfca55949f51bf3970bae7c506807db97dbcf05f (patch) | |
tree | 636f2db663256926cc087b831102afdff9824c64 | |
parent | cebe5c2fac708885c018550f7ef4610df613e5af (diff) | |
download | rails-cfca55949f51bf3970bae7c506807db97dbcf05f.tar.gz rails-cfca55949f51bf3970bae7c506807db97dbcf05f.tar.bz2 rails-cfca55949f51bf3970bae7c506807db97dbcf05f.zip |
convert duration to an attr_reader
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 7e89402822..34bccb83d0 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -33,7 +33,7 @@ module ActiveSupport end class Event - attr_reader :name, :time, :end, :transaction_id, :payload + attr_reader :name, :time, :end, :transaction_id, :payload, :duration def initialize(name, start, ending, transaction_id, payload) @name = name @@ -41,14 +41,11 @@ module ActiveSupport @time = start @transaction_id = transaction_id @end = ending - end - - def duration - @duration ||= 1000.0 * (@end - @time) + @duration = 1000.0 * (@end - @time) end def parent_of?(event) - start = (self.time - event.time) * 1000 + start = (time - event.time) * 1000 start <= 0 && (start + duration >= event.duration) end end |