Class: Wands::HTTPResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/wands/http_response.rb

Overview

Example usage:

response = HTTPResponse.new response.parse(socket) response.header # => [“websocket”] response.header # => [“Upgrade”] response.header # => [“s3pPLMBiTxaQ9kYGzzhZRbK+xOo=”]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



26
27
28
# File 'lib/wands/http_response.rb', line 26

def header
  @header
end

#statusObject (readonly)

Returns the value of attribute status.



26
27
28
# File 'lib/wands/http_response.rb', line 26

def status
  @status
end

Instance Method Details

#parse(stream) ⇒ Object



28
29
30
31
# File 'lib/wands/http_response.rb', line 28

def parse(stream)
  @response = read_from stream
  @status, @header = headers_of @response
end

#to_sObject



33
34
35
# File 'lib/wands/http_response.rb', line 33

def to_s
  @response
end