class Puppet::Pops::Binder::Producers::EvaluatingProducer

Evaluates a Puppet Expression and returns the result. This is typically used for strings with interpolated expressions. @api public

Attributes

expression[R]

A Puppet 3 AST Expression @api public

Public Instance Methods

internal_produce(scope) click to toggle source

@api private

# File lib/puppet/pops/binder/producers.rb, line 305
def internal_produce(scope)
  Puppet::Pops::Parser::EvaluatingParser.new.evaluate(scope, expression)
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::Model::Expression>] :expression The expression to evaluate @api public

# File lib/puppet/pops/binder/producers.rb, line 298
def initialize(injector, binding, scope, options)
  super
  @expression = options[:expression]
  raise ArgumentError, "Option 'expression' must be given to an EvaluatingProducer." unless @expression
end