Class: Rubai::Response
- Inherits:
-
Object
- Object
- Rubai::Response
- Defined in:
- lib/rubai/response.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(body_text) ⇒ Object
- #body ⇒ Object
- #content_type ⇒ Object
- #content_type=(content_type) ⇒ Object
- #headers ⇒ Object
-
#initialize(status = 200, content_type = "text/html", body = []) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(status = 200, content_type = "text/html", body = []) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 |
# File 'lib/rubai/response.rb', line 5 def initialize(status = 200, content_type = "text/html", body=[]) @status = status self.content_type= content_type @body = body end |
Instance Attribute Details
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/rubai/response.rb', line 3 def status @status end |
Class Method Details
.new_with_body(body) ⇒ Object
11 12 13 |
# File 'lib/rubai/response.rb', line 11 def self.new_with_body body self.new 200, "text/html", [body] end |
Instance Method Details
#<<(body_text) ⇒ Object
19 20 21 |
# File 'lib/rubai/response.rb', line 19 def <<(body_text) body << body_text end |
#body ⇒ Object
15 16 17 |
# File 'lib/rubai/response.rb', line 15 def body @body ||= [] end |
#content_type ⇒ Object
27 28 29 |
# File 'lib/rubai/response.rb', line 27 def content_type self["Content-Type"] end |
#content_type=(content_type) ⇒ Object
23 24 25 |
# File 'lib/rubai/response.rb', line 23 def content_type=(content_type) self["Content-Type"] = content_type end |
#headers ⇒ Object
35 36 37 |
# File 'lib/rubai/response.rb', line 35 def headers @headers ||= {} end |