Sha256: f8728faf77231c9b2cb5431b12fe926bf00da5772671de201f3e1bc280999da6

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

unless defined?(Mongo)
  require "mongo"
end

# Mongoo.conn = lambda { Mongo::Connection.new("localhost", 27017, :pool_size => 5, :timeout => 5) }
# Mongoo.db   = "mydb"
# Mongoo.conn => #<Mongo::Connection:0x00000100db8ac0>

module Mongoo
  INDEX_META = {}
  ATTRIBUTE_META = {}

  class << self
    attr_accessor :verbose_debug

    def conn=(conn_lambda)
      @conn_lambda = conn_lambda
      @_conn = nil
      @_db = nil
      @conn_lambda
    end

    def db=(db_name)
      @db_name = db_name
      @_db = nil
      @db_name
    end

    def conn
      @_conn ||= (@conn_lambda && @conn_lambda.call)
    end

    def db
      @_db ||= (conn && conn.db(@db_name))
    end

    def async?
      Mongo.async?
    end
  end
end

require "forwardable"

require "active_support/core_ext"
require "active_model"

require "mongoo/hash_ext"
require "mongoo/cursor"
require "mongoo/attribute_sanitizer"
require "mongoo/attribute_proxy"
require "mongoo/changelog"
require "mongoo/persistence"
require "mongoo/modifiers"
require "mongoo/core"
require "mongoo/base"
require "mongoo/embedded/base"
require "mongoo/embedded/array_proxy"
require "mongoo/embedded/hash_proxy"
require "mongoo/mongohash"
require "mongoo/identity_map"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoo-0.4.8 lib/mongoo.rb
mongoo-0.4.7 lib/mongoo.rb
mongoo-0.4.6 lib/mongoo.rb