Panel
MustachePanel is a Rack::Bug panel which tracks the time spent rendering Mustache views as well as all the variables accessed during view rendering.
It can be used to track down slow partials and ensure you’re only generating data you need.
Also, it’s fun.
Clear out our page load-specific variables.
# File lib/rack/bug/panels/mustache_panel.rb, line 46 def self.reset Thread.current["rack.bug.mustache.times"] = {} Thread.current["rack.bug.mustache.vars"] = {} end
The content of our Rack::Bug panel
# File lib/rack/bug/panels/mustache_panel.rb, line 74 def content View.render ensure self.class.reset end
The string used for our tab in Rack::Bug’s navigation bar
# File lib/rack/bug/panels/mustache_panel.rb, line 67 def heading "{{%.2fms}}" % self.class.times.values.inject(0.0) do |sum, obj| sum + obj end end
The name of this Rack::Bug panel
# File lib/rack/bug/panels/mustache_panel.rb, line 62 def name "mustache" end
Generated with the Darkfish Rdoc Generator 2.