Sha256: 41fe027f0279b653584e9a7e82ac254faaa17e4fa7a1a1c8e7abcf5703e201a2

Contents?: true

Size: 437 Bytes

Versions: 1

Compression:

Stored size: 437 Bytes

Contents

module MongoDoc
  def self.database(name = nil)
    if name
      @@database = connection.db(name)
    else
      raise NoDatabaseError unless defined? @@database
      @@database
    end
  end
  
  def self.connection
    raise NoConnectionError unless defined? @@connection
    @@connection
  end
    
  def self.connect(*args)
    opts = args.extract_options!
    @@connection = Mongo::Connection.new(args[0], args[1], opts)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongodoc-0.0.0 lib/mongodoc/connection.rb