Class: Mxrb::Http::Response
- Inherits:
-
Object
- Object
- Mxrb::Http::Response
- Defined in:
- lib/mxrb/http/server.rb
Overview
Mutable response keeps the existing MXRB dispatchers independent of Rack.
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
-
#initialize ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
26 27 28 29 30 |
# File 'lib/mxrb/http/server.rb', line 26 def initialize @status = 200 @body = '' @headers = {} end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
23 24 25 |
# File 'lib/mxrb/http/server.rb', line 23 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
24 25 26 |
# File 'lib/mxrb/http/server.rb', line 24 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
23 24 25 |
# File 'lib/mxrb/http/server.rb', line 23 def status @status end |
Instance Method Details
#[](name) ⇒ Object
32 |
# File 'lib/mxrb/http/server.rb', line 32 def [](name) = headers[name] |
#[]=(name, value) ⇒ Object
34 35 36 |
# File 'lib/mxrb/http/server.rb', line 34 def []=(name, value) headers[name] = value end |