lib/couch_potato.rb in langalex-couch_potato-0.2.2 vs lib/couch_potato.rb in langalex-couch_potato-0.2.3
- old
+ new
@@ -9,16 +9,20 @@
module CouchPotato
Config = OpenStruct.new
+ # Returns a database instance which you can then use to create objects and query views. You have to set the CouchPotato::Config.database_name before this works.
def self.database
@@__database ||= Database.new(self.couchrest_database)
end
+ # Returns the underlying CouchRest database object if you want low level access to your CouchDB. You have to set the CouchPotato::Config.database_name before this works.
def self.couchrest_database
@@__couchrest_database ||= CouchRest.database(full_url_to_database)
end
+
+ private
def self.full_url_to_database
database_name = CouchPotato::Config.database_name || raise('No Database configured. Set CouchPotato::Config.database_name')
url = database_name
if url !~ /^http:\/\//