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.
7 8 9 10 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 7 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.
5 6 7 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 5 def add @add end |
#param ⇒ Object
Returns the value of attribute param.
5 6 7 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 5 def param @param end |
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 5 def value @value end |
Instance Method Details
#each ⇒ Object
12 13 14 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 12 def each [@param, @value].each { |child| yield child } end |
#evaluate(scope) ⇒ Object
Return the parameter and the value.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 17 def evaluate(scope) value = @value.safeevaluate(scope) return Puppet::Parser::Resource::Param.new( :name => @param, :value => value.nil? ? :undef : value, :source => scope.source, :line => self.line, :file => self.file, :add => self.add ) end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/puppet/parser/ast/resourceparam.rb', line 29 def to_s "#{@param} => #{@value}" end |