Sha256: a5ef07d9b65d03403ee4f63e13ebe071841e3e2f8ebec72e3605920132e19409

Contents?: true

Size: 517 Bytes

Versions: 2

Compression:

Stored size: 517 Bytes

Contents

module Frisky
  @@mongo          = nil
  @@mongo_database = nil

  CONFIG_EXTENSIONS ||= []
  CONFIG_EXTENSIONS << :frisky_mongo_config=

  def self.frisky_mongo_config=(config)
    @@mongo = Mongo::Connection.from_uri(config['mongo']) if config['mongo']

    if @@mongo
      uri                    = URI.parse(config['mongo'])
      @@mongo_database        = uri.path.gsub(/^\//, '')
      MongoMapper.connection = @@mongo
      MongoMapper.database   = @@mongo_database
    end
  end

  def mongo; @@mongo; end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frisky_mongo-0.7.2 lib/frisky-mongo/config.rb
frisky_mongo-0.7.1 lib/frisky-mongo/config.rb