Class: Rackr::Router::DevHtml::Dump

Inherits:
Object
  • Object
show all
Includes:
Action
Defined in:
lib/rackr/router/dev_html/dump.rb

Overview

This is the action that is called when a dump is raised

Constant Summary

Constants included from Action

Action::BUILD_RESPONSE, Action::DEFAULT_CSP_HEADERS, Action::DEFAULT_HEADERS, Action::MIME_TYPES, Action::RENDER

Instance Method Summary collapse

Methods included from Action

included

Instance Method Details

#call(env) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/rackr/router/dev_html/dump.rb', line 59

def call(env)
  res = response(<<-HTML
    <!DOCTYPE html>
    <html>
    <head>
      <title>Application dump</title>
      <style>
        body {
          padding: 0px;
          margin: 0px;
          font:small sans-serif;
          background-color: #2b2b2b;
          color: white;
        }
        h2 {
          margin: 0px;
          padding: 0.2em;
          background-color: #353535;
        }
        li {
          padding: 0px;
        }
        div {
          margin: 1em;
        }
      </style>
    </head>
    <body>
      <h2>#{env['dump'].content.class}</h2>
      <div>
        <h3>Methods</h3>
        #{env['dump'].content.methods}
        <h3>Content</h3>
        #{PrettyPrint.call(env['dump'].content)}
      </div>
    </body>
    </html>
  HTML
                )
  res.status = 200
  res.headers['content-type'] = 'text/html'
  render res:
end