Sha256: e5e902f4ad051e42340f3abc19d19058afc8e6af3089ffed3f4fdf7412871c5e
Contents?: true
Size: 1.38 KB
Versions: 6
Compression:
Stored size: 1.38 KB
Contents
module AeEasy module Core module Plugin module ConfigBehavior include AeEasy::Core::Plugin::ContextIntegrator include AeEasy::Core::Plugin::CollectionVault attr_reader :config_collection_key # Hook to map config behavior on self # # @param [Hash] opts ({}) Configuration options. # @option opts [Array] :config_collection ([:config, 'config']) Key value pair array to se a custom collection. # # @example # initialize_hook_core_config_behavior config_collection: [:my_config, 'abc'] # config_collection # # => 'abc' def initialize_hook_core_config_behavior opts = {} @config_collection_key, collection = opts[:config_collection] || [:config, 'config'] add_collection config_collection_key, collection end # Get config collection name. # @return [String] def config_collection collections[config_collection_key] end # Find a configuration value by item key. # # @param [Symbol] key Item key to find. # # @note Instance must implement: # * `find_output(collection, query)` def find_config key value = find_output config_collection, '_id' => key value ||= {'_collection' => config_collection, '_id' => key} end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems