module Nucleon::Mixin::ConfigOptions
Contextualized option collection¶ ↑
The Nucleon::Mixin::ConfigOptions
module extends a class to include methods for working with the central option collection.
Right now, largely for historical reasons, the Nucleon::Config::Options
class is structured as a global interface and collection for grouping all of the defined options. It was originally contained within Nucleon::Config
as part of the global configuration interface. In the future, the class and this mixin will be refactored to support multiple collections of contextualized properties.
For usage and definition:
-
See core configuration object
Nucleon::Config
-
See collection
Nucleon::Config::Options
Public Instance Methods
Return a reference to all of the globally defined context properties.
This method generally should not be used in favor of the ::get method.
See:
# File lib/core/mixin/config/options.rb 48 def all_options 49 Config::Options.all 50 end
Clear all properties for specified contexts.
Contexts are entirely removed, even the name itself.
See:
# File lib/core/mixin/config/options.rb 81 def clear_options(contexts = nil) 82 Config::Options.clear(contexts) 83 end
Return an array of context names based on given contexts and an optional hierarchy path.
This method mainly exists to allow us to create cascading context groups for the properties based on a hierarchical list. We use it to create contextual property lookups for configuring Puppet in the corl gem.
See:
# File lib/core/mixin/config/options.rb 37 def contexts(contexts = [], hierarchy = []) 38 Config::Options.contexts(contexts, hierarchy) 39 end
Return merged option groups for given context names.
This method allows us to easily request combinations of properties.
See:
# File lib/core/mixin/config/options.rb 59 def get_options(contexts, force = true) 60 Config::Options.get(contexts, force) 61 end
Assign property values to specified context identifiers.
This method allows us to easily merge properties across various contexts.
See:
# File lib/core/mixin/config/options.rb 70 def set_options(contexts, options, force = true) 71 Config::Options.set(contexts, options, force) 72 end