Class: NaiveHttpResponse
- Inherits:
-
Object
- Object
- NaiveHttpResponse
- Defined in:
- lib/bane/naive_http_response.rb
Defined Under Namespace
Classes: HttpHeader
Constant Summary collapse
- CRLF =
"\r\n"
Instance Method Summary collapse
-
#initialize(response_code, response_description, content_type, body) ⇒ NaiveHttpResponse
constructor
A new instance of NaiveHttpResponse.
- #to_s ⇒ Object
Constructor Details
#initialize(response_code, response_description, content_type, body) ⇒ NaiveHttpResponse
Returns a new instance of NaiveHttpResponse.
18 19 20 21 22 23 |
# File 'lib/bane/naive_http_response.rb', line 18 def initialize(response_code, response_description, content_type, body) @code = response_code @description = response_description @content_type = content_type @body = body end |
Instance Method Details
#to_s ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/bane/naive_http_response.rb', line 25 def to_s str = [] str << "HTTP/1.1 #{@code} #{@description}" str << http_header.to_s str << "" str << @body str.join(CRLF) end |