summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/objectparam.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/ast/objectparam.rb')
-rw-r--r--lib/puppet/parser/ast/objectparam.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/puppet/parser/ast/objectparam.rb b/lib/puppet/parser/ast/objectparam.rb
new file mode 100644
index 000000000..41cd050ef
--- /dev/null
+++ b/lib/puppet/parser/ast/objectparam.rb
@@ -0,0 +1,30 @@
+class Puppet::Parser::AST
+ # The AST object for the parameters inside ObjectDefs and Selectors.
+ class ObjectParam < AST::Branch
+ attr_accessor :value, :param
+
+ def each
+ [@param,@value].each { |child| yield child }
+ end
+
+ # Return the parameter and the value.
+ def evaluate(scope)
+ param = @param.safeevaluate(scope)
+ value = @value.safeevaluate(scope)
+ return [param, value]
+ 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