summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/node.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-11-03 19:58:38 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-11-03 19:59:37 -0700
commit9e2a0e41dfb253a19180aeea6b66f65ca8d63133 (patch)
treef102b396669c074b59eab5c2e59c5145b5bae6ab /lib/puppet/parser/ast/node.rb
parentb1ef091d0209a59ac747568f83416e992db93ea8 (diff)
parent85543a41978924a42490d0c3f1f5437c95b7c869 (diff)
downloadpuppet-9e2a0e41dfb253a19180aeea6b66f65ca8d63133.tar.gz
puppet-9e2a0e41dfb253a19180aeea6b66f65ca8d63133.tar.xz
puppet-9e2a0e41dfb253a19180aeea6b66f65ca8d63133.zip
Merge commit '85543a4'
This updates `master` to the pre-agile-iteration state.
Diffstat (limited to 'lib/puppet/parser/ast/node.rb')
-rw-r--r--lib/puppet/parser/ast/node.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/puppet/parser/ast/node.rb b/lib/puppet/parser/ast/node.rb
new file mode 100644
index 000000000..b69a5c4e0
--- /dev/null
+++ b/lib/puppet/parser/ast/node.rb
@@ -0,0 +1,20 @@
+require 'puppet/parser/ast/top_level_construct'
+
+class Puppet::Parser::AST::Node < Puppet::Parser::AST::TopLevelConstruct
+ attr_accessor :names, :context
+
+ def initialize(names, context = {}, &ruby_code)
+ raise ArgumentError, "names should be an array" unless names.is_a? Array
+ @names = names
+ @context = context
+ @ruby_code = ruby_code
+ end
+
+ def instantiate(modname)
+ @names.collect do |name|
+ new_node = Puppet::Resource::Type.new(:node, name, @context.merge(:module_name => modname))
+ new_node.ruby_code = @ruby_code if @ruby_code
+ new_node
+ end
+ end
+end