Sha256: 35735646d4c6722a3424f5f3699b47e0648a2fe8785cdc9ca5d77dca619b5023
Contents?: true
Size: 664 Bytes
Versions: 19
Compression:
Stored size: 664 Bytes
Contents
require 'mongo' module Insulin # Author:: Sam (mailto:sam@cruft.co) # License:: MIT # This class is a simple wrapper around a MongoDB connection class MongoHandle attr_reader :db, :connection # Set up the connection as described by 'conf' def initialize conf @conf = conf begin @connection = Mongo::Connection.new @db = @connection.db @conf["database"] rescue Mongo::ConnectionFailure puts "MongoDB doesn't appear to be running. We can't go on without this" exit 1 end end # Drop this database def drop_db @connection.drop_database @conf["database"] end end end
Version data entries
19 entries across 19 versions & 1 rubygems