Module: Busket
- Defined in:
- lib/busket.rb,
lib/busket/helper.rb
Defined Under Namespace
Modules: Helper
Constant Summary collapse
- @@database_name =
nil
Class Method Summary collapse
- .mongo_connection ⇒ Object
- .mongo_connection=(new_connection) ⇒ Object
- .mongo_database ⇒ Object
- .mongo_database=(name) ⇒ Object
- .mongo_logger ⇒ Object
Class Method Details
.mongo_connection ⇒ Object
7 8 9 |
# File 'lib/busket.rb', line 7 def self.mongo_connection @@connection ||= Mongo::Connection.new end |
.mongo_connection=(new_connection) ⇒ Object
11 12 13 |
# File 'lib/busket.rb', line 11 def self.mongo_connection=(new_connection) @@connection = new_connection end |
.mongo_database ⇒ Object
24 25 26 27 28 |
# File 'lib/busket.rb', line 24 def self.mongo_database raise 'You forgot to set the default database name: Busket.database = "foobar"' unless @@database_name @@database ||= Busket.mongo_connection.db(@@database_name) end |
.mongo_database=(name) ⇒ Object
19 20 21 22 |
# File 'lib/busket.rb', line 19 def self.mongo_database=(name) @@database = nil @@database_name = name end |
.mongo_logger ⇒ Object
15 16 17 |
# File 'lib/busket.rb', line 15 def self.mongo_logger connection.logger end |