class Puppet::Pops::Binder::Producers::LookupKeyProducer

@api public

Attributes

key[R]

@api public

Protected Instance Methods

internal_produce(scope) click to toggle source

@api private

# File lib/puppet/pops/binder/producers.rb, line 366
def internal_produce(scope)

  result = super
  result.is_a?(Hash) ? result[key] : nil
end

Public Class Methods

new(injector, binder, scope, options) click to toggle source

@param injector [Puppet::Pops::Binder::Injector] The injector where the lookup originates @param binder [Puppet::Pops::Binder::Bindings::Binding, nil] The binding using this producer @param scope [Puppet::Parser::Scope] The scope to use for evaluation @option options [Puppet::Pops::Model::LambdaExpression] :transformer (nil) a transformer of produced value @option options [Puppet::Pops::Types::PAnyType] :type The type to lookup @option options [String] :name (”) The name to lookup @option options [Puppet::Pops::Types::PAnyType] :key The key to lookup in the hash @api public

# File lib/puppet/pops/binder/producers.rb, line 357
def initialize(injector, binder, scope, options)
  super
  @key = options[:key]
  raise ArgumentError, "Option 'key' must be given in a LookupKeyProducer." if key.nil?
end