Class: Insight::TemplatesPanel
- Inherits:
-
Panel
- Object
- Panel
- Insight::TemplatesPanel
show all
- Defined in:
- lib/insight/panels/templates_panel.rb,
lib/insight/panels/templates_panel/rendering.rb
Defined Under Namespace
Classes: Rendering
Instance Attribute Summary
Attributes inherited from Panel
#request
Instance Method Summary
collapse
Methods inherited from Panel
#after, #before, #call, current_panel_file, excluded, file_index, from_file, #has_content?, inherited, #panel_app, panel_exclusion, panel_mappings, #render
#probe
Methods included from Logging
logger
#key_sql_template, #retrieve, #store, #table_length, #table_setup
Methods included from Render
#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params
Constructor Details
Returns a new instance of TemplatesPanel.
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/insight/panels/templates_panel.rb', line 6
def initialize(app)
super
probe(self) do
instrument "ActionView::Template" do
instance_probe :render
end
end
table_setup("templates")
@current = nil
end
|
Instance Method Details
#after_detect(method_call, timing, args, result) ⇒ Object
38
39
40
41
|
# File 'lib/insight/panels/templates_panel.rb', line 38
def after_detect(method_call, timing, args, result)
@current.timing = timing
@current = @current.parent
end
|
#before_detect(method_call, args) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/insight/panels/templates_panel.rb', line 30
def before_detect(method_call, args)
template_name = method_call.object.virtual_path
rendering = Rendering.new(template_name)
@current.add(rendering)
@current = rendering
end
|
#content_for_request(number) ⇒ Object
51
52
53
54
|
# File 'lib/insight/panels/templates_panel.rb', line 51
def content_for_request(number)
result = render_template "panels/templates", :root_rendering => retrieve(number).first
return result
end
|
#heading_for_request(number) ⇒ Object
47
48
49
|
# File 'lib/insight/panels/templates_panel.rb', line 47
def heading_for_request(number)
"Templates: %.2fms" % (retrieve(number).inject(0.0){|memo, rendering| memo + rendering.duration})
end
|
#name ⇒ Object
43
44
45
|
# File 'lib/insight/panels/templates_panel.rb', line 43
def name
"templates"
end
|
#request_finish(env, status, headers, body, timing) ⇒ Object
25
26
27
28
|
# File 'lib/insight/panels/templates_panel.rb', line 25
def request_finish(env, status, , body, timing)
store(env, @current)
@current = nil
end
|
#request_start(env, start) ⇒ Object
21
22
23
|
# File 'lib/insight/panels/templates_panel.rb', line 21
def request_start(env, start)
@current = Rendering.new("root")
end
|