Class: Reifier::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/reifier/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(socket) ⇒ Response

Returns a new instance of Response.



5
6
7
8
# File 'lib/reifier/response.rb', line 5

def initialize(socket)
  @socket   = socket
  @response = ''
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/reifier/response.rb', line 3

def body
  @body
end

#headersObject

Returns the value of attribute headers.



3
4
5
# File 'lib/reifier/response.rb', line 3

def headers
  @headers
end

#protocolObject

Returns the value of attribute protocol.



3
4
5
# File 'lib/reifier/response.rb', line 3

def protocol
  @protocol
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/reifier/response.rb', line 3

def status
  @status
end

Instance Method Details

#<<(rack_return) ⇒ Object



19
20
21
22
23
# File 'lib/reifier/response.rb', line 19

def <<(rack_return)
  @status  = rack_return[0]
  @headers = rack_return[1]
  @body    = rack_return[2]
end

#handleObject



10
11
12
13
14
15
16
17
# File 'lib/reifier/response.rb', line 10

def handle
  handle_request_line
  handle_headers
  handle_body

  @socket.write @response
  @socket.close
end