Module: Mongoid::Clients::Options::ClassMethods
- Defined in:
- lib/mongoid/clients/options.rb
Instance Method Summary collapse
- #client_name ⇒ Object
- #collection ⇒ Object
- #collection_name ⇒ Object
- #database_name ⇒ Object
- #mongo_client ⇒ Object
- #persistence_context ⇒ Object
-
#with(options, &block) ⇒ Object
Change the persistence context for this class during the block.
Instance Method Details
#client_name ⇒ Object
72 73 74 |
# File 'lib/mongoid/clients/options.rb', line 72 def client_name persistence_context.client_name end |
#collection ⇒ Object
84 85 86 |
# File 'lib/mongoid/clients/options.rb', line 84 def collection persistence_context.collection end |
#collection_name ⇒ Object
76 77 78 |
# File 'lib/mongoid/clients/options.rb', line 76 def collection_name persistence_context.collection_name end |
#database_name ⇒ Object
80 81 82 |
# File 'lib/mongoid/clients/options.rb', line 80 def database_name persistence_context.database_name end |
#mongo_client ⇒ Object
88 89 90 |
# File 'lib/mongoid/clients/options.rb', line 88 def mongo_client persistence_context.client end |
#persistence_context ⇒ Object
113 114 115 |
# File 'lib/mongoid/clients/options.rb', line 113 def persistence_context PersistenceContext.get(self) || PersistenceContext.new(self) end |
#with(options, &block) ⇒ Object
Change the persistence context for this class during the block.
104 105 106 107 108 109 110 111 |
# File 'lib/mongoid/clients/options.rb', line 104 def with(, &block) original_context = PersistenceContext.get(self) original_cluster = persistence_context.cluster PersistenceContext.set(self, ) yield self ensure PersistenceContext.clear(self, original_cluster, original_context) end |