Class: Rack::Bug::TemplatesPanel::Trace

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/bug/panels/templates_panel/trace.rb

Instance Method Summary collapse

Constructor Details

#initializeTrace

Returns a new instance of Trace.



19
20
21
# File 'lib/rack/bug/panels/templates_panel/trace.rb', line 19

def initialize
  @current = root
end

Instance Method Details

#finished(template_name) ⇒ Object



14
15
16
17
# File 'lib/rack/bug/panels/templates_panel/trace.rb', line 14

def finished(template_name)
  @current.end_time = Time.now
  @current = @current.parent
end

#rootObject



27
28
29
# File 'lib/rack/bug/panels/templates_panel/trace.rb', line 27

def root
  @root ||= Rendering.new("root")
end

#start(template_name) ⇒ Object



7
8
9
10
11
12
# File 'lib/rack/bug/panels/templates_panel/trace.rb', line 7

def start(template_name)
  rendering = Rendering.new(template_name)
  rendering.start_time = Time.now
  @current.add(rendering)
  @current = rendering
end

#total_timeObject



23
24
25
# File 'lib/rack/bug/panels/templates_panel/trace.rb', line 23

def total_time
  root.child_time
end