Class: Puppet::Pops::Binder::Producers::EvaluatingProducer
- Defined in:
- lib/puppet/pops/binder/producers.rb
Overview
Evaluates a Puppet Expression and returns the result. This is typically used for strings with interpolated expressions.
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
A Puppet 3 AST Expression.
Attributes inherited from Producer
Instance Method Summary collapse
-
#initialize(injector, binding, scope, options) ⇒ EvaluatingProducer
constructor
A new instance of EvaluatingProducer.
- #internal_produce(scope) ⇒ Object private
Methods inherited from Producer
Constructor Details
#initialize(injector, binding, scope, options) ⇒ EvaluatingProducer
Returns a new instance of EvaluatingProducer.
301 302 303 304 305 |
# File 'lib/puppet/pops/binder/producers.rb', line 301 def initialize(injector, binding, scope, ) super @expression = [:expression] raise ArgumentError, "Option 'expression' must be given to an EvaluatingProducer." unless @expression end |
Instance Attribute Details
#expression ⇒ Object (readonly)
A Puppet 3 AST Expression
292 293 294 |
# File 'lib/puppet/pops/binder/producers.rb', line 292 def expression @expression end |
Instance Method Details
#internal_produce(scope) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
308 309 310 |
# File 'lib/puppet/pops/binder/producers.rb', line 308 def internal_produce(scope) Parser::EvaluatingParser.new.evaluate(scope, expression) end |