Module: AeEasy::Core::Plugin::ConfigBehavior
- Includes:
- CollectionVault, ContextIntegrator
- Included in:
- Config
- Defined in:
- lib/ae_easy/core/plugin/config_behavior.rb
Instance Attribute Summary collapse
-
#config_collection_key ⇒ Object
readonly
Returns the value of attribute config_collection_key.
Attributes included from ContextIntegrator
Instance Method Summary collapse
-
#config_collection ⇒ String
Get config collection name.
-
#find_config(key) ⇒ Object
Find a configuration value by item key.
-
#initialize_hook_core_config_behavior(opts = {}) ⇒ Object
Hook to map config behavior on self.
Methods included from CollectionVault
Methods included from ContextIntegrator
#initialize_hook_core_context_integrator, #mock_context
Instance Attribute Details
#config_collection_key ⇒ Object (readonly)
Returns the value of attribute config_collection_key
5 6 7 |
# File 'lib/ae_easy/core/plugin/config_behavior.rb', line 5 def config_collection_key @config_collection_key end |
Instance Method Details
#config_collection ⇒ String
Get config collection name.
26 27 28 |
# File 'lib/ae_easy/core/plugin/config_behavior.rb', line 26 def config_collection collections[config_collection_key] end |
#find_config(key) ⇒ Object
Note:
Instance must implement:
-
`find_output(collection, query)`
Find a configuration value by item key.
36 37 38 39 |
# File 'lib/ae_easy/core/plugin/config_behavior.rb', line 36 def find_config key value = find_output config_collection, '_id' => key value ||= {'_collection' => config_collection, '_id' => key} end |
#initialize_hook_core_config_behavior(opts = {}) ⇒ Object
Hook to map config behavior on self
19 20 21 22 |
# File 'lib/ae_easy/core/plugin/config_behavior.rb', line 19 def initialize_hook_core_config_behavior opts = {} @config_collection_key, collection = opts[:config_collection] || [:config, 'config'] add_collection config_collection_key, collection end |