summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/resourceparam.rb
blob: 4073a197b1217604bf9e3051ac6a6e39d78d6ab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'puppet/parser/ast/branch'

class Puppet::Parser::AST
  # The AST object for the parameters inside ResourceDefs and Selectors.
  class ResourceParam < AST::Branch
    attr_accessor :value, :param, :add

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

    # Return the parameter and the value.
    def evaluate(scope)

            return Puppet::Parser::Resource::Param.new(
                
        :name => @param,
        :value => @value.safeevaluate(scope),
        
        :source => scope.source, :line => self.line, :file => self.file,
        :add => self.add
      )
    end

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