Class: Puppet::Parser::AST::ResourceParam

Inherits:
Branch show all
Defined in:
lib/puppet/parser/ast/resourceparam.rb

Overview

The AST object for the parameters inside ResourceDefs and Selectors.

Instance Attribute Summary collapse

Attributes inherited from Branch

#children, #pin

Instance Method Summary collapse

Methods inherited from Branch

#initialize

Constructor Details

This class inherits a constructor from Puppet::Parser::AST::Branch

Instance Attribute Details

#addObject



6
7
8
# File 'lib/puppet/parser/ast/resourceparam.rb', line 6

def add
  @add
end

#paramObject



6
7
8
# File 'lib/puppet/parser/ast/resourceparam.rb', line 6

def param
  @param
end

#valueObject



6
7
8
# File 'lib/puppet/parser/ast/resourceparam.rb', line 6

def value
  @value
end

Instance Method Details

#eachObject



8
9
10
# File 'lib/puppet/parser/ast/resourceparam.rb', line 8

def each
  [@param,@value].each { |child| yield child }
end

#evaluate(scope) ⇒ Object

Return the parameter and the value.



13
14
15
16
17
18
19
20
21
# File 'lib/puppet/parser/ast/resourceparam.rb', line 13

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_sObject



23
24
25
# File 'lib/puppet/parser/ast/resourceparam.rb', line 23

def to_s
  "#{@param} => #{@value.to_s}"
end