summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/resourceparam.rb
blob: c552a7ee5f8063bd76cc233580fb4c5f3c82dbd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
    end
end