Class: MongoMapper::DatabasesPool
- Inherits:
-
Hash
- Object
- Hash
- MongoMapper::DatabasesPool
- Defined in:
- lib/mongo_mapper_ext/db_config.rb
Instance Attribute Summary collapse
-
#mongo_mapper ⇒ Object
Returns the value of attribute mongo_mapper.
Instance Method Summary collapse
- #[](database_alias) ⇒ Object
-
#initialize(mongo_mapper) ⇒ DatabasesPool
constructor
A new instance of DatabasesPool.
Constructor Details
#initialize(mongo_mapper) ⇒ DatabasesPool
Returns a new instance of DatabasesPool.
29 30 31 |
# File 'lib/mongo_mapper_ext/db_config.rb', line 29 def initialize mongo_mapper self.mongo_mapper = mongo_mapper end |
Instance Attribute Details
#mongo_mapper ⇒ Object
Returns the value of attribute mongo_mapper.
28 29 30 |
# File 'lib/mongo_mapper_ext/db_config.rb', line 28 def mongo_mapper @mongo_mapper end |
Instance Method Details
#[](database_alias) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mongo_mapper_ext/db_config.rb', line 33 def [](database_alias) database_alias = database_alias.to_s unless db = super(database_alias) mongo_mapper.db_config.should! :include, database_alias = mongo_mapper.db_config[database_alias] db = mongo_mapper.connections[database_alias].db ['name'].should!(:be_a, String) self[database_alias] = db end return db end |