Module: RocketJob::MongoidClients::Options
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rocket_job/extensions/mongoid/clients/options.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #collection(parent = nil) ⇒ Object
- #collection_name ⇒ Object
- #collection_name=(collection_name) ⇒ Object
- #with_collection(collection_name) ⇒ Object
Instance Method Details
#collection(parent = nil) ⇒ Object
13 14 15 |
# File 'lib/rocket_job/extensions/mongoid/clients/options.rb', line 13 def collection(parent = nil) @collection_name ? mongo_client[@collection_name] : super(parent) end |
#collection_name ⇒ Object
17 18 19 |
# File 'lib/rocket_job/extensions/mongoid/clients/options.rb', line 17 def collection_name @collection_name || super end |
#collection_name=(collection_name) ⇒ Object
21 22 23 |
# File 'lib/rocket_job/extensions/mongoid/clients/options.rb', line 21 def collection_name=(collection_name) @collection_name = collection_name&.to_sym end |
#with_collection(collection_name) ⇒ Object
8 9 10 11 |
# File 'lib/rocket_job/extensions/mongoid/clients/options.rb', line 8 def with_collection(collection_name) self.collection_name = collection_name self end |