module Boxlet::Db
Attributes
db[RW]
Public Instance Methods
connect()
click to toggle source
# File lib/boxlet/db.rb, line 15 def connect config = Boxlet.config db_config = config[:db][config[:environment].to_sym || :development] host = db_config[:host] || 'localhost' port = db_config[:port] || MongoClient::DEFAULT_PORT Boxlet.log(:info, "INFO: Connecting to #{host}:#{port}") client = MongoClient.new(host, port) db = client.db(db_config[:db] || 'boxlet_development') return db end
connection()
click to toggle source
# File lib/boxlet/db.rb, line 11 def connection @db ||= self.connect end