Class: ROM::CouchDB::Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ROM::CouchDB::Gateway
- Defined in:
- lib/rom/couchdb/gateway.rb
Overview
CouchDB gateway for ROM
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#sets ⇒ Object
readonly
Returns the value of attribute sets.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #dataset(name) ⇒ Object
- #dataset?(name) ⇒ Boolean
-
#initialize(uri) ⇒ Gateway
constructor
A new instance of Gateway.
Constructor Details
#initialize(uri) ⇒ Gateway
Returns a new instance of Gateway.
9 10 11 12 |
# File 'lib/rom/couchdb/gateway.rb', line 9 def initialize(uri) @connection = CouchRest.database(uri) @sets = {} end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
7 8 9 |
# File 'lib/rom/couchdb/gateway.rb', line 7 def connection @connection end |
#sets ⇒ Object (readonly)
Returns the value of attribute sets.
7 8 9 |
# File 'lib/rom/couchdb/gateway.rb', line 7 def sets @sets end |
Instance Method Details
#[](name) ⇒ Object
18 19 20 |
# File 'lib/rom/couchdb/gateway.rb', line 18 def [](name) @sets.fetch(name) end |
#dataset(name) ⇒ Object
14 15 16 |
# File 'lib/rom/couchdb/gateway.rb', line 14 def dataset(name) @sets[name] = Dataset.new([], connection: @connection) end |
#dataset?(name) ⇒ Boolean
22 23 24 |
# File 'lib/rom/couchdb/gateway.rb', line 22 def dataset?(name) @sets.include?(name) end |