Class R10K::Settings::Container
In: lib/r10k/settings/container.rb
Parent: Object

Defines a collection for application settings

This implements a hierarchical interface to application settings. Containers can define an optional parent container that will be used for default options if those options aren‘t set on the given container.

Methods

[]   []=   add_valid_key   new   reset!   valid_key?  

Classes and Modules

Class R10K::Settings::Container::InvalidKey

Attributes

valid_keys  [RW]  @!attribute [r] valid_keys
  @return [Set<Symbol>] All valid keys defined on the container or parent container.

Public Class methods

@param parent [R10K::Settings::Container] An optional parent container

Public Instance methods

Look up a value in the container. The lookup checks the current container, and then falls back to the parent container if it‘s given.

@param key [Symbol] The lookup key

@return [Object, nil] The retrieved value if present.

@raise [R10K::Settings::Container::InvalidKey] If the looked up key isn‘t

  a valid key.

Set a value on the container

@param key [Symbol] The lookup key @param value [Object] The value to store in the container

@raise [R10K::Settings::Container::InvalidKey] If the looked up key isn‘t

  a valid key.

Define a valid container key

@note This should only be used by {R10K::Settings::ClassSettings}

@param key [Symbol] @return [void]

Clear all existing settings in this container. Valid settings are left alone. @return [void]

Determine if a key is a valid setting.

@param key [Symbol]

@return [true, false]

[Validate]