lib/remnant/template/rendering.rb in remnant-0.3.0 vs lib/remnant/template/rendering.rb in remnant-0.3.1
- old
+ new
@@ -4,18 +4,21 @@
attr_accessor :name
attr_accessor :start_time
attr_accessor :end_time
attr_accessor :parent
attr_accessor :children
+ attr_accessor :depth
def initialize(name)
@name = name
@children = []
+ @depth = 0
end
def add(rendering)
@children << rendering
+ rendering.depth = depth + 1
rendering.parent = self
end
def time
@end_time - @start_time
@@ -29,11 +32,12 @@
children.inject(0.0) {|memo, c| memo + c.time}
end
def results
@results ||= {name.to_s => {
- 'time' => time * 1000.0,
- 'exclusive' => exclusive_time * 1000.0,
+ 'time' => time * 1000,
+ 'exclusive' => exclusive_time * 1000,
+ 'depth' => depth,
'children' => children.map(&:results)
}
}
end
end