Class: Puppet::Parser::AST::ResourceParam
- Inherits:
-
Branch
- Object
- Puppet::Parser::AST
- Branch
- Puppet::Parser::AST::ResourceParam
- Defined in:
- lib/puppet/parser/ast/resourceparam.rb
Overview
The AST object for the parameters inside resource expressions
Constant Summary
Constants inherited from Puppet::Parser::AST
Instance Attribute Summary collapse
-
#add ⇒ Object
Returns the value of attribute add.
-
#param ⇒ Object
Returns the value of attribute param.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Branch
Attributes inherited from Puppet::Parser::AST
#file, #line, #parent, #pos, #scope
Instance Method Summary collapse
- #each ⇒ Object
-
#evaluate(scope) ⇒ Object
Return the parameter and the value.
-
#initialize(argshash) ⇒ ResourceParam
constructor
A new instance of ResourceParam.
- #to_s ⇒ Object
Methods inherited from Puppet::Parser::AST
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, error_location, error_location_with_space, error_location_with_unknowns, #exceptwrap, #fail
Constructor Details
#initialize(argshash) ⇒ ResourceParam
Returns a new instance of ResourceParam.
8 9 10 11 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 8 def initialize(argshash) Puppet.warn_once('deprecations', 'AST::ResourceParam', _('Use of Puppet::Parser::AST::ResourceParam is deprecated and not fully functional')) super(argshash) end |
Instance Attribute Details
#add ⇒ Object
Returns the value of attribute add.
6 7 8 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 6 def add @add end |
#param ⇒ Object
Returns the value of attribute param.
6 7 8 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 6 def param @param end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 6 def value @value end |
Instance Method Details
#each ⇒ Object
13 14 15 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 13 def each [@param, @value].each { |child| yield child } end |
#evaluate(scope) ⇒ Object
Return the parameter and the value.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 18 def evaluate(scope) value = @value.safeevaluate(scope) Puppet::Parser::Resource::Param.new( :name => @param, :value => value.nil? ? :undef : value, :source => scope.source, :line => line, :file => file, :add => add ) end |
#to_s ⇒ Object
30 31 32 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 30 def to_s "#{@param} => #{@value}" end |