class Puppet::Pops::Binder::Producers::FirstFoundProducer

@api public

Attributes

producers[R]

@api public

Protected Instance Methods

internal_produce(scope) click to toggle source

@api private

# File lib/puppet/pops/binder/producers.rb, line 275
def internal_produce(scope)
  # return the first produced value that is non-nil (unfortunately there is no such enumerable method)
  producers.reduce(nil) {|memo, p| break memo unless memo.nil?; p.produce(scope)}
end

Public Class Methods

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

@param injector [Puppet::Pops::Binder::Injector] The injector where the lookup originates @param binding [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 [Array<Puppet::Pops::Binder::Producers::Producer>] :producers list of producers to consult. Required. @api public

# File lib/puppet/pops/binder/producers.rb, line 265
def initialize(injector, binding, scope, options)
  super
  @producers = options[:producers]
  raise ArgumentError, "Option :producers' must be set to a list of producers." if @producers.nil?
  raise ArgumentError, "Given 'producers' option is not an Array" unless @producers.is_a?(Array)
end