Class: CouchRest::Response

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

Direct Known Subclasses

Document

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pkeys = {}) ⇒ Response

Returns a new instance of Response.



4
5
6
7
8
9
10
11
# File 'lib/couchrest/response.rb', line 4

def initialize(pkeys = {})
  pkeys ||= {}
  pkeys.each do |k,v|
    self[k.to_s] = v
  end
  @headers = pkeys.respond_to?(:headers) ? pkeys.headers : {}
  @raw     = pkeys.respond_to?(:raw) ? pkeys.raw : nil
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



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

def headers
  @headers
end

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

Instance Method Details

#[](key) ⇒ Object



21
22
23
# File 'lib/couchrest/response.rb', line 21

def [](key)
  super(key.to_s)
end

#[]=(key, value) ⇒ Object



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

def []=(key, value)
  super(key.to_s, value)
end

#delete(key) ⇒ Object



17
18
19
# File 'lib/couchrest/response.rb', line 17

def delete(key)
  super(key.to_s)
end