Permalink
Browse files

convert duration to an attr_reader

  • Loading branch information...
1 parent cebe5c2 commit cfca55949f51bf3970bae7c506807db97dbcf05f @tenderlove tenderlove committed Jul 17, 2010
Showing with 3 additions and 6 deletions.
  1. +3 −6 activesupport/lib/active_support/notifications/instrumenter.rb
@@ -33,22 +33,19 @@ def unique_id
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
@payload = payload.dup
@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

0 comments on commit cfca559

Please sign in to comment.