Class: Horseman::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, headers = {}) ⇒ Response

Returns a new instance of Response.



7
8
9
10
11
# File 'lib/horseman/response.rb', line 7

def initialize(body, headers={})
  @body = body
  @headers = headers
  @document = Dom::Document.new(@body)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#documentObject (readonly)

Returns the value of attribute document.



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

def document
  @document
end

#headersObject (readonly)

Returns the value of attribute headers.



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

def headers
  @headers
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
# File 'lib/horseman/response.rb', line 13

def[](key)
  @headers[key]
end