Class: Rack::Bug::Panel

Inherits:
Object
  • Object
show all
Includes:
ERB::Util, Render
Defined in:
lib/rack/bug/panel.rb

Overview

Panels are also Rack middleware

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Render

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

Constructor Details

#initialize(app) ⇒ Panel

Returns a new instance of Panel.



13
14
15
16
17
18
19
# File 'lib/rack/bug/panel.rb', line 13

def initialize(app)
  if panel_app
    @app = Rack::Cascade.new([panel_app, app])
  else
    @app = app
  end
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



11
12
13
# File 'lib/rack/bug/panel.rb', line 11

def request
  @request
end

Instance Method Details

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



41
42
# File 'lib/rack/bug/panel.rb', line 41

def after(env, status, headers, body)
end

#before(env) ⇒ Object



38
39
# File 'lib/rack/bug/panel.rb', line 38

def before(env)
end

#call(env) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/rack/bug/panel.rb', line 21

def call(env)
  before(env)
  status, headers, body = @app.call(env)
  @request = Request.new(env)
  after(env, status, headers, body)
  env["rack-bug.panels"] << self
  return [status, headers, body]
end

#has_content?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/rack/bug/panel.rb', line 34

def has_content?
  true
end

#panel_appObject



30
31
32
# File 'lib/rack/bug/panel.rb', line 30

def panel_app
  nil
end

#render(template) ⇒ Object



44
45
# File 'lib/rack/bug/panel.rb', line 44

def render(template)
end