Class: CouchClient::Collection
- Inherits:
-
Array
- Object
- Array
- CouchClient::Collection
- Defined in:
- lib/couch-client/collection.rb
Overview
Collection is an extended Array that provides additional methods and state to get status codes, info and connect documents to the server.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
Instance Method Summary collapse
-
#initialize(code, body, connection) ⇒ Collection
constructor
Collection is constructed with a status code, response body, and connection object.
Constructor Details
#initialize(code, body, connection) ⇒ Collection
Collection is constructed with a status code, response body, and connection object.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/couch-client/collection.rb', line 9 def initialize(code, body, connection) # Iterate over each row to set them a CouchClient::Row object. body.delete("rows").each.with_index do |row, idx| self[idx] = Row.new(code, row, connection) end @code = code @info = body @connection = connection end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/couch-client/collection.rb', line 5 def code @code end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
5 6 7 |
# File 'lib/couch-client/collection.rb', line 5 def info @info end |