class Remnant::Template::Rendering

Attributes

children[RW]
depth[RW]
end_time[RW]
name[RW]
parent[RW]
start_time[RW]

Public Class Methods

new(name) click to toggle source
# File lib/remnant/template/rendering.rb, line 11
def initialize(name)
  @name = name
  @children = []
  @depth = 0
end

Public Instance Methods

add(rendering) click to toggle source
# File lib/remnant/template/rendering.rb, line 17
def add(rendering)
  @children << rendering
  rendering.depth = depth + 1
  rendering.parent = self
end
child_time() click to toggle source
# File lib/remnant/template/rendering.rb, line 31
def child_time
  children.inject(0.0) {|memo, c| memo + c.time}
end
exclusive_time() click to toggle source
# File lib/remnant/template/rendering.rb, line 27
def exclusive_time
  time - child_time
end
results() click to toggle source
# File lib/remnant/template/rendering.rb, line 35
def results
  @results ||= {name.to_s => {
      'time' => time * 1000,
      'exclusive' => exclusive_time * 1000,
      'depth' => depth,
      'children' => children.map(&:results)
    }
  }
end
time() click to toggle source
# File lib/remnant/template/rendering.rb, line 23
def time
  @end_time - @start_time
end