Skip to content

Commit

Permalink
convert duration to an attr_reader
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jul 17, 2010
1 parent cebe5c2 commit cfca559
Showing 1 changed file with 3 additions and 6 deletions.
Expand Up @@ -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
Expand Down

0 comments on commit cfca559

Please sign in to comment.