Sha256: e7ba4bbe9f6c6567c10267d2d82fd8649716dbd7c21fe2a31fc0ccd98cdf6ccd
Contents?: true
Size: 663 Bytes
Versions: 1
Compression:
Stored size: 663 Bytes
Contents
require 'rubygems' begin require 'mongoid' rescue LoadError => e raise Capcode::MissingLibrary, "Mongoid could not be loaded (is it installed?): #{e.message}" end require 'yaml' require 'logger' module Capcode Resource = Mongoid::Document class Base end class << self def db_connect( dbfile, logfile ) dbconfig = YAML::load(File.open(dbfile)).keys_to_sym connection = Mongo::Connection.new(dbconfig[:host], dbconfig[:port]) Mongoid.database = connection.db(dbconfig[:database]) if dbconfig[:username] Mongoid.database.authenticate(dbconfig[:username], dbconfig[:password]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capcode-base-mongoid-0.1.0 | lib/capcode/base/mongoid.rb |