Class: Rack::Insight::RequestVariablesPanel

Inherits:
Panel
  • Object
show all
Defined in:
lib/rack/insight/panels/request_variables_panel.rb

Instance Attribute Summary

Attributes inherited from Panel

#request

Instance Method Summary collapse

Methods inherited from Panel

#after_detect, #before, #bool_prop, #call, #camelized_name, #content, current_panel_file, excluded, file_index, from_file, #handle_error_for, #has_content?, #has_custom_probes?, has_table, #has_table?, #heading_for_request, inherited, #initialize, #inspect, #is_magic?, #is_probing?, #name, #panel_app, panel_exclusion, panel_mappings, #render, set_sub_class_template_root, #underscored_name

Methods included from Database::EigenClient

included

Methods included from Instrumentation::EigenClient

included

Methods included from Logging

logger, verbose, verbosity

Methods included from Instrumentation::Client

#after_detect, #before_detect, #probe, #request_finish, #request_start

Methods included from Database::RequestDataClient

#count, #key_sql_template, #retrieve, #store, #table_length, #table_setup

Methods included from Render

#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params

Constructor Details

This class inherits a constructor from Rack::Insight::Panel

Instance Method Details

#after(env, status, headers, body) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rack/insight/panels/request_variables_panel.rb', line 4

def after(env,status,headers,body)
  sections = {}
  sections["GET"] = sort(@request.GET) if @request.GET.any?
  sections["POST"] = sort(@request.POST) if @request.POST.any?
  # TODO: Better Fix for Rails 4 (as part of splitting panels into separate gems)
  if defined?(ActionDispatch::Request::Session)
    sections["Session"] = sort(@request.env["rack.session"].to_hash) if @request.env["rack.session"] && @request.env["rack.session"].present?
  else
    sections["Session"] = sort(@request.env["rack.session"]) if @request.env["rack.session"] && @request.env["rack.session"].any?
  end
  sections["Cookies"] = sort(@request.env["rack.request.cookie_hash"]) if @request.env["rack.request.cookie_hash"] && @request.env["rack.request.cookie_hash"].any?
  server, rack = split_and_filter_env(@env)
  sections["SERVER VARIABLES"] = sort(server)
  sections["Rack ENV"] = sort(rack)

#      require 'pp'
#      ::File.open("sections.dump", "w") do |file|
#        PP.pp(sections, file)
#      end
  store(env, sections)
end

#content_for_request(number) ⇒ Object



30
31
32
33
34
# File 'lib/rack/insight/panels/request_variables_panel.rb', line 30

def content_for_request(number)
  sections = retrieve(number).first

  render_template "panels/request_variables", :sections => sections
end

#headingObject



26
27
28
# File 'lib/rack/insight/panels/request_variables_panel.rb', line 26

def heading
  "Rack Env"
end