class Rack::Bug::MustachePanel::View

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.

Public Instance Methods

times() click to toggle source

We track the render times of all the Mustache views on this page load.

# File lib/rack/bug/panels/mustache_panel.rb, line 18
def times
  MustachePanel.times.each_with_object({}) do |obj, key, value|
    obj[key] = value
  end
end
variables() click to toggle source

Any variables used in this page load are collected and displayed.

# File lib/rack/bug/panels/mustache_panel.rb, line 25
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 (LIMIT) to give you
    # some idea.
    size = value.size

    if value.is_a?(Array) && size > LIMIT
      value = value.first(LIMIT)
      value << "...and #{size - LIMIT} more"
    end

    { :key => key, :value => value.inspect }
  end
end