Class: FPM::Cookery::Hiera::Instance
- Inherits:
-
Hiera
- Object
- Hiera
- FPM::Cookery::Hiera::Instance
- Includes:
- Defaults
- Defined in:
- lib/fpm/cookery/hiera.rb
Overview
Hiera
subclass that wraps a recipe class
Instance Attribute Summary collapse
-
#recipe ⇒ Object
readonly
Returns the value of attribute recipe.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(recipe, options = {}) ⇒ Instance
constructor
Expects a recipe class and a hash containing one key,
:config
. -
#lookup(key, default = nil, scope = self.scope, *rest) ⇒ Object
(also: #[])
Provides a default scope, and attempts to look up the key both as a string and as a symbol.
Methods included from Defaults
hiera_backends, hiera_config, hiera_datadir, hiera_hierarchy, hiera_logger
Constructor Details
#initialize(recipe, options = {}) ⇒ Instance
Expects a recipe class and a hash containing one key, :config
.
18 19 20 21 22 23 24 25 |
# File 'lib/fpm/cookery/hiera.rb', line 18 def initialize(recipe, = {}) @recipe = recipe @scope = Scope.new(recipe) # For some reason, +Hiera+'s constructor expects a hash with just the # one key. super({ :config => hiera_config() }) end |
Instance Attribute Details
#recipe ⇒ Object (readonly)
Returns the value of attribute recipe.
15 16 17 |
# File 'lib/fpm/cookery/hiera.rb', line 15 def recipe @recipe end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
15 16 17 |
# File 'lib/fpm/cookery/hiera.rb', line 15 def scope @scope end |
Instance Method Details
#lookup(key, default = nil, scope = self.scope, *rest) ⇒ Object Also known as: []
Provides a default scope, and attempts to look up the key both as a string and as a symbol.
29 30 31 |
# File 'lib/fpm/cookery/hiera.rb', line 29 def lookup(key, default = nil, scope = self.scope, *rest) super(key.to_s, default, scope, *rest) end |