blob: 248e91b32e9006fe59a3e3373ed3946a334f9512 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
|
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
def each
[@param,@value].each { |child| yield child }
end
# Return the parameter and the value.
def evaluate(hash)
scope = hash[:scope]
param = @param
value = @value.safeevaluate(:scope => scope)
args = {:name => param, :value => value, :source => scope.source}
[:line, :file].each do |p|
if v = self.send(p)
args[p] = v
end
end
return Puppet::Parser::Resource::Param.new(args)
end
def tree(indent = 0)
return [
@param.tree(indent + 1),
((@@indline * indent) + self.typewrap(self.pin)),
@value.tree(indent + 1)
].join("\n")
end
def to_s
return "%s => %s" % [@param,@value]
end
end
end
# $Id$
|