Module: CouchCrumbs
- Defined in:
- lib/couch_crumbs.rb,
lib/couch_crumbs/view.rb,
lib/couch_crumbs/query.rb,
lib/couch_crumbs/design.rb,
lib/couch_crumbs/server.rb,
lib/couch_crumbs/database.rb,
lib/couch_crumbs/document.rb
Defined Under Namespace
Modules: Document, Query Classes: Database, Design, Server, View
Constant Summary collapse
- @@default_server =
Defaults
@@default_database = nil
Class Method Summary collapse
-
.connect(opts = {}) ⇒ Object
Connect to a specific couch server/database.
-
.default_database ⇒ Object
Return a default database that models will use.
-
.default_server ⇒ Object
Return a default server for use.
Class Method Details
.connect(opts = {}) ⇒ Object
Connect to a specific couch server/database
Parameters
- server_uri<String>
-
host/port in URI form
- default_database<String>
-
default database name
29 30 31 32 33 34 35 |
# File 'lib/couch_crumbs.rb', line 29 def self.connect(opts = {}) @@default_server = Server.new(:uri => opts[:server_uri]) @@default_database = Database.new(:name => opts[:default_database]) # return true if both server and database were instantiated (@@default_server && @@default_database) ? true : (raise "unable to connect CouchCrumbs to a CouchDB instance") end |
.default_database ⇒ Object
Return a default database that models will use
45 46 47 |
# File 'lib/couch_crumbs.rb', line 45 def self.default_database @@default_database or (raise "default database is only available after calling CouchCrumbs::connect") end |
.default_server ⇒ Object
Return a default server for use
39 40 41 |
# File 'lib/couch_crumbs.rb', line 39 def self.default_server @@default_server or (raise "default server is only available after calling CouchCrumbs::connect") end |