Class: Rakie::HttpResponse
- Inherits:
-
Object
- Object
- Rakie::HttpResponse
- Includes:
- Proto
- Defined in:
- lib/rakie/http_proto.rb
Defined Under Namespace
Classes: Head
Constant Summary collapse
- PARSE_HEAD =
0
- PARSE_HEADERS =
1
- PARSE_CONTENT =
2
Constants included from Proto
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#head ⇒ Object
Returns the value of attribute head.
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
-
#initialize ⇒ HttpResponse
constructor
A new instance of HttpResponse.
- #serialize ⇒ Object
Methods included from Proto
#parse, #parse_offset, #parse_offset=, #parse_state, #parse_state=, #parse_status, #to_s
Constructor Details
#initialize ⇒ HttpResponse
Returns a new instance of HttpResponse.
174 175 176 177 178 |
# File 'lib/rakie/http_proto.rb', line 174 def initialize @head = Head.new @headers = {} @content = '' end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
162 163 164 |
# File 'lib/rakie/http_proto.rb', line 162 def content @content end |
#head ⇒ Object
Returns the value of attribute head.
162 163 164 |
# File 'lib/rakie/http_proto.rb', line 162 def head @head end |
#headers ⇒ Object
Returns the value of attribute headers.
162 163 164 |
# File 'lib/rakie/http_proto.rb', line 162 def headers @headers end |
Instance Method Details
#serialize ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/rakie/http_proto.rb', line 180 def serialize data = "" data += "#{head.version} #{head.status} #{head.}" data += "\r\n" headers_list = [] headers.each do |k, v| headers_list << "#{k}: #{v}" end data += headers_list.join("\r\n") data += "\r\n\r\n" data += content end |