Class: CouchDB::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/couchdb/row.rb

Overview

The Row class acts as a wrapper for a CouchDB view result row.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database, attributes = { }) ⇒ Row

Returns a new instance of Row.



12
13
14
# File 'lib/couchdb/row.rb', line 12

def initialize(database, attributes = { })
  @database, @id, @key, @value, @document = database, *attributes.values_at("id", "key", "value", "doc")
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



7
8
9
# File 'lib/couchdb/row.rb', line 7

def database
  @database
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/couchdb/row.rb', line 8

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



9
10
11
# File 'lib/couchdb/row.rb', line 9

def key
  @key
end

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'lib/couchdb/row.rb', line 10

def value
  @value
end

Instance Method Details

#documentObject



16
17
18
# File 'lib/couchdb/row.rb', line 16

def document
  Document.new @database, @document
end