Class: Rack::Insight::TemplatesPanel
- Inherits:
-
Panel
- Object
- Panel
- Rack::Insight::TemplatesPanel
show all
- Defined in:
- lib/rack/insight/panels/templates_panel.rb,
lib/rack/insight/panels/templates_panel/stats.rb,
lib/rack/insight/panels/templates_panel/rendering.rb
Defined Under Namespace
Classes: Rendering, Stats
Instance Attribute Summary
Attributes inherited from Panel
#request
Instance Method Summary
collapse
Methods inherited from Panel
#after, #before, #bool_prop, #call, #camelized_name, #content, current_panel_file, excluded, file_index, from_file, #handle_error_for, #has_content?, #has_custom_probes?, has_table, #has_table?, #heading, inherited, #initialize, #inspect, #is_magic?, #is_probing?, #name, #panel_app, panel_exclusion, panel_mappings, #render, set_sub_class_template_root, #underscored_name
included
included
Methods included from Logging
logger, verbose, verbosity
#probe
#count, #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
Instance Method Details
#after_detect(method_call, timing, args, result) ⇒ Object
21
22
23
|
# File 'lib/rack/insight/panels/templates_panel.rb', line 21
def after_detect(method_call, timing, args, result)
@stats.finish_record!(timing.duration)
end
|
#before_detect(method_call, args) ⇒ Object
15
16
17
18
19
|
# File 'lib/rack/insight/panels/templates_panel.rb', line 15
def before_detect(method_call, args)
template_name = method_call.object.virtual_path
rendering = Rendering.new(template_name)
@stats.begin_record!(rendering)
end
|
#content_for_request(number) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/rack/insight/panels/templates_panel.rb', line 38
def content_for_request(number)
stat = retrieve(number).first
rendering_root = stat.root if stat.respond_to?(:root)
if rendering_root
render_template 'magic_panel', :magic_insights => rendering_root.children, :name => "Templates: #{(rendering_root._human_time)}"
else
render_template 'no_data', :name => self.camelized_name
end
end
|
#heading_for_request(number) ⇒ Object
25
26
27
|
# File 'lib/rack/insight/panels/templates_panel.rb', line 25
def heading_for_request(number)
"Templates: #{heading_time(number)}"
end
|
#heading_time(number) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/rack/insight/panels/templates_panel.rb', line 29
def heading_time(number)
stat = retrieve(number).first
if stat.respond_to?(:root)
if stat.root.respond_to?(:_human_time)
stat.root._human_time
end
end
end
|
#request_finish(env, status, headers, body, timing) ⇒ Object
9
10
11
12
13
|
# File 'lib/rack/insight/panels/templates_panel.rb', line 9
def request_finish(env, status, , body, timing)
@stats.finish!
store(env, @stats)
@stats = nil
end
|
#request_start(env, start) ⇒ Object