Class: Rack::Insight::PanelsHeader

Inherits:
PanelApp
  • Object
show all
Defined in:
lib/rack/insight/panels-header.rb

Instance Attribute Summary

Attributes inherited from PanelApp

#request

Instance Method Summary collapse

Methods inherited from PanelApp

#call, #not_found, #params, #render_template, #validate_params

Methods included from Render

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

Methods included from Logging

logger, verbose, verbosity

Constructor Details

#initialize(insight_app) ⇒ PanelsHeader

Returns a new instance of PanelsHeader.



3
4
5
6
# File 'lib/rack/insight/panels-header.rb', line 3

def initialize(insight_app)
  @insight_app = insight_app
  @request_table = Database::RequestTable.new
end

Instance Method Details

#dispatchObject



8
9
10
11
12
13
14
15
16
# File 'lib/rack/insight/panels-header.rb', line 8

def dispatch
  return not_found("not get") unless @request.get?
  return not_found("id nil") if params['request_id'].nil?
  request = @request_table.select("*", "id = #{params['request_id']}").first
  return not_found("id not found") if request.nil?
  render_template("headers_fragment",
                  :request_id => params['request_id'].to_i,
                  :panels => @insight_app.panels)
end