Module: MongoLight::Connection
- Defined in:
- lib/mongo_light/connection.rb
Class Method Summary collapse
- .[](collection_name) ⇒ Object
- .collections ⇒ Object
- .connection ⇒ Object
- .database ⇒ Object
- .handle_passenger_forking ⇒ Object
- .setup(configuration) ⇒ Object
Class Method Details
.[](collection_name) ⇒ Object
24 25 26 |
# File 'lib/mongo_light/connection.rb', line 24 def self.[](collection_name) @@database.collection(collection_name) end |
.collections ⇒ Object
20 21 22 |
# File 'lib/mongo_light/connection.rb', line 20 def self.collections @@database.collections end |
.connection ⇒ Object
12 13 14 |
# File 'lib/mongo_light/connection.rb', line 12 def self.connection @@connection end |
.database ⇒ Object
16 17 18 |
# File 'lib/mongo_light/connection.rb', line 16 def self.database @@database end |
.handle_passenger_forking ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/mongo_light/connection.rb', line 28 def self.handle_passenger_forking if defined?(PhusionPassenger) PhusionPassenger.on_event(:starting_worker_process) do |forked| @@connection.connect if forked end end end |
.setup(configuration) ⇒ Object
6 7 8 9 10 |
# File 'lib/mongo_light/connection.rb', line 6 def self.setup(configuration) @@connection = configuration.connection @@database = @@connection.db(configuration.database) handle_passenger_forking end |