提交 cfca5594 编写于 作者: A Aaron Patterson

convert duration to an attr_reader

上级 cebe5c2f
......@@ -33,7 +33,7 @@ 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
......@@ -41,14 +41,11 @@ def initialize(name, start, ending, transaction_id, payload)
@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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册