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.
298 299 300 301 302 |
# File 'lib/puppet/pops/binder/producers.rb', line 298 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
289 290 291 |
# File 'lib/puppet/pops/binder/producers.rb', line 289 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.
305 306 307 |
# File 'lib/puppet/pops/binder/producers.rb', line 305 def internal_produce(scope) Puppet::Pops::Parser::EvaluatingParser.new.evaluate(scope, expression) end |