class Rack::Bug::MustachePanel
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.
Public Class Methods
reset()
click to toggle source
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
times()
click to toggle source
The view render times for this page load
# File lib/rack/bug/panels/mustache_panel.rb, line 52 def self.times Thread.current["rack.bug.mustache.times"] ||= {} end
variables()
click to toggle source
The variables used on this page load
# File lib/rack/bug/panels/mustache_panel.rb, line 57 def self.variables Thread.current["rack.bug.mustache.vars"] ||= {} end
Public Instance Methods
content()
click to toggle source
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
heading()
click to toggle source
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
name()
click to toggle source
The name of this Rack::Bug panel
# File lib/rack/bug/panels/mustache_panel.rb, line 62 def name "mustache" end