Sha256: 20e76c01d63039046590865c91327b47af21bdc1409004c3299278ac4ae2f0e2

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 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 self.mongo; @@mongo[@@mongo_database]; end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frisky_mongo-0.7.7 lib/frisky-mongo/config.rb