Class: Wouter::Response
- Inherits:
-
Object
- Object
- Wouter::Response
- Defined in:
- lib/wouter.rb
Overview
Outgoing HTTP Response Wrapper
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #body(b) ⇒ Object
- #build_response ⇒ Object
-
#initialize ⇒ Response
constructor
A new instance of Response.
- #status(s) ⇒ Object
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
20 21 22 23 24 |
# File 'lib/wouter.rb', line 20 def initialize @headers = {'Content-Type' => 'text/html'} @body = "" @status = 200 end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
18 19 20 |
# File 'lib/wouter.rb', line 18 def headers @headers end |
Instance Method Details
#body(b) ⇒ Object
26 27 28 29 |
# File 'lib/wouter.rb', line 26 def body(b) @body = b self end |
#build_response ⇒ Object
36 37 38 |
# File 'lib/wouter.rb', line 36 def build_response [@status, @headers, [@body]] end |
#status(s) ⇒ Object
31 32 33 34 |
# File 'lib/wouter.rb', line 31 def status(s) @status = s self end |