Class: WebConsole::Response
- Inherits:
-
Struct
- Object
- Struct
- WebConsole::Response
- Defined in:
- lib/web_console/response.rb
Overview
A response object that writes content before the closing
A response object that writes content before the closing
tag, if possible.
The object quacks like Rack::Response.
Returns the value of attribute body.
Returns the value of attribute headers.
Returns the value of attribute status.
Returns the value of attribute body
6 7 8 |
# File 'lib/web_console/response.rb', line 6 def body @body end |
Returns the value of attribute headers
6 7 8 |
# File 'lib/web_console/response.rb', line 6 def headers @headers end |
Returns the value of attribute status
6 7 8 |
# File 'lib/web_console/response.rb', line 6 def status @status end |
19 20 21 |
# File 'lib/web_console/response.rb', line 19 def finish Rack::Response.new(body, status, headers).finish end |
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/web_console/response.rb', line 7 def write(content) raw_body = Array(body).first.to_s if position = raw_body.rindex('</body>') raw_body.insert(position, content) else raw_body << content end self.body = raw_body end |