Module: Puppet::DataProviders::HieraInterpolate
- Included in:
- HieraConfig, JsonDataProvider, YamlDataProvider
- Defined in:
- lib/puppet/data_providers/hiera_interpolate.rb
Overview
Add support for Hiera-like interpolation expressions. The expressions may contain keys that uses dot-notation to further navigate into hashes and arrays
Instance Method Summary collapse
Instance Method Details
#interpolate(subject, lookup_invocation, allow_methods) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/puppet/data_providers/hiera_interpolate.rb', line 7 def interpolate(subject, lookup_invocation, allow_methods) case subject when String subject.index('%{').nil? ? subject : interpolate_string(subject, lookup_invocation, allow_methods) when Array subject.map { |element| interpolate(element, lookup_invocation, allow_methods) } when Hash Hash[subject.map { |k, v| [k, interpolate(v, lookup_invocation, allow_methods)] }] else subject end end |