lib/couch_potato.rb in langalex-couch_potato-0.2.8 vs lib/couch_potato.rb in langalex-couch_potato-0.2.9
- old
+ new
@@ -5,11 +5,11 @@
require 'ostruct'
module CouchPotato
- Config = OpenStruct.new
+ Config = Struct.new(:database_name).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
@@ -21,13 +21,13 @@
private
def self.full_url_to_database
raise('No Database configured. Set CouchPotato::Config.database_name') unless CouchPotato::Config.database_name
- if CouchPotato::Config.database_server
- return "#{CouchPotato::Config.database_server}#{CouchPotato::Config.database_name}"
+ if CouchPotato::Config.database_name[0,7] == 'http://'
+ CouchPotato::Config.database_name
else
- return "http://127.0.0.1:5984/#{CouchPotato::Config.database_name}"
+ "http://127.0.0.1:5984/#{CouchPotato::Config.database_name}"
end
end
end
require File.dirname(__FILE__) + '/core_ext/object'