Class: CrossOrigin::Config
- Inherits:
-
Object
- Object
- CrossOrigin::Config
- Defined in:
- lib/cross_origin.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #collection_for(model) ⇒ Object
- #collection_name_for(model) ⇒ Object
-
#initialize(name, options) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(name, options) ⇒ Config
41 42 43 44 |
# File 'lib/cross_origin.rb', line 41 def initialize(name, ) @name = name = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
39 40 41 |
# File 'lib/cross_origin.rb', line 39 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
39 40 41 |
# File 'lib/cross_origin.rb', line 39 def end |
Instance Method Details
#collection_for(model) ⇒ Object
50 51 52 |
# File 'lib/cross_origin.rb', line 50 def collection_for(model) (Mongoid::Clients.clients[name] || Mongoid.default_client)[collection_name_for(model)] end |
#collection_name_for(model) ⇒ Object
46 47 48 |
# File 'lib/cross_origin.rb', line 46 def collection_name_for(model) "#{name}_#{model.mongoid_root_class.storage_options_defaults[:collection]}" end |