Class: Rack::Bug::MustachePanel::View
- Defined in:
- lib/rack/bug/panels/mustache_panel.rb
Overview
The view is responsible for rendering our panel. While Rack::Bug takes care of the nav, the content rendered by View is used for the panel itself.
Constant Summary
Constants inherited from Mustache
Instance Attribute Summary
Attributes inherited from Mustache
Instance Method Summary collapse
-
#times ⇒ Object
We track the render times of all the Mustache views on this page load.
-
#variables ⇒ Object
Any variables used in this page load are collected and displayed.
Methods inherited from Mustache
#[], #[]=, classify, compiled?, #compiled?, #context, path, path=, raise_on_context_miss=, #raise_on_context_miss?, raise_on_context_miss?, #render, render, render_file, #render_file, template, #template, #template=, template=, template_extension, template_extension=, template_file, template_file=, template_name, template_name=, template_path, template_path=, #templateify, templateify, to_html, to_text, underscore, view_class, view_namespace, view_namespace=, view_path, view_path=
Instance Method Details
#times ⇒ Object
We track the render times of all the Mustache views on this page load.
22 23 24 25 26 |
# File 'lib/rack/bug/panels/mustache_panel.rb', line 22 def times MustachePanel.times.map do |key, value| { :key => key, :value => value } end end |
#variables ⇒ Object
Any variables used in this page load are collected and displayed.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rack/bug/panels/mustache_panel.rb', line 29 def variables vars = MustachePanel.variables.sort_by { |key, _| key.to_s } vars.map do |key, value| # Arrays can get too huge. Just show the first 10 to give you # some idea. if value.is_a?(Array) && value.size > 10 size = value.size value = value.first(10) value << "...and #{size - 10} more" end { :key => key, :value => value.inspect } end end |