Sha256: efcc9154ae51e51236e9964e3e22579e09b7e20a08163bb927b1c6821e2f55bf

Contents?: true

Size: 504 Bytes

Versions: 3

Compression:

Stored size: 504 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
      @connection = Mongo::Connection.new 
      @db = @connection.db @conf["database"]
    end

    # Drop this database
    def drop_db
      @connection.drop_database @conf["database"]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
insulin-0.0.11 lib/insulin/mongo_handle.rb
insulin-0.0.10 lib/insulin/mongo_handle.rb
insulin-0.0.9 lib/insulin/mongo_handle.rb