Class: ROM::CouchDB::Gateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/rom/couchdb/gateway.rb

Overview

CouchDB gateway for ROM

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#connectionObject (readonly)

Returns the value of attribute connection.



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

def connection
  @connection
end

#setsObject (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

Returns:

  • (Boolean)


22
23
24
# File 'lib/rom/couchdb/gateway.rb', line 22

def dataset?(name)
  @sets.include?(name)
end