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.

Methods
C
H
N
R
T
V
Classes and Modules
Class Public methods
reset()

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()

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()

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
Instance Public methods
content()

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()

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()

The name of this Rack::Bug panel

# File lib/rack/bug/panels/mustache_panel.rb, line 62
      def name
        "mustache"
      end