lib/yogi_berra/catcher.rb in yogi_berra-0.0.4 vs lib/yogi_berra/catcher.rb in yogi_berra-0.0.5
- old
+ new
@@ -1,7 +1,8 @@
require 'mongo'
require 'facets'
+require 'yaml'
module YogiBerra
class Catcher
extend Facets
cattr_accessor :settings, :mongo_client, :connection
@@ -36,12 +37,12 @@
rescue
YogiBerra::Logger.log("Couldn't connect to the mongo database on host: #{host} port: #{port}.", :error)
nil
end
- def quick_connection
- load_db_settings unless @@settings
+ def quick_connection(load_settings = false)
+ load_db_settings if load_settings
if @@settings
host = @@settings["host"]
port = @@settings["port"]
client = db_client(host, port)
@@ -49,10 +50,10 @@
@@connection = client[@@settings["database"]]
else
YogiBerra::Logger.log("Couldn't connect to the mongo database on host: #{host} port: #{port}.", :error)
end
else
- YogiBerra::Logger.log("Couldn't load the yogi.yml file.", :error)
+ YogiBerra::Logger.log("Couldn't load the yogi.yml file.", :error) if load_settings
end
@@connection
end
end
end
\ No newline at end of file