Class: Puppet::Parser::AST::Hostclass
- Inherits:
-
TopLevelConstruct
- Object
- Puppet::Parser::AST
- TopLevelConstruct
- Puppet::Parser::AST::Hostclass
- Defined in:
- lib/vendor/puppet/parser/ast/hostclass.rb
Constant Summary
Constants inherited from Puppet::Parser::AST
Constants included from Util::Docs
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Puppet::Parser::AST
Attributes included from Util::Docs
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(name, context = {}, &ruby_code) ⇒ Hostclass
constructor
A new instance of Hostclass.
- #instantiate(modname) ⇒ Object
Methods inherited from Puppet::Parser::AST
associates_doc, #evaluate, #evaluate_match, #inspect, #parsefail, #parsewrap, #safeevaluate, settor?, #use_docs
Methods included from Util::Docs
#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub
Methods included from Util::MethodHelper
#requiredopts, #set_options, #symbolize_options
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail
Constructor Details
#initialize(name, context = {}, &ruby_code) ⇒ Hostclass
Returns a new instance of Hostclass.
6 7 8 9 10 |
# File 'lib/vendor/puppet/parser/ast/hostclass.rb', line 6 def initialize(name, context = {}, &ruby_code) @context = context @name = name @ruby_code = ruby_code end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
4 5 6 |
# File 'lib/vendor/puppet/parser/ast/hostclass.rb', line 4 def context @context end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/vendor/puppet/parser/ast/hostclass.rb', line 4 def name @name end |
Instance Method Details
#code ⇒ Object
26 27 28 |
# File 'lib/vendor/puppet/parser/ast/hostclass.rb', line 26 def code() @context[:code] end |
#instantiate(modname) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vendor/puppet/parser/ast/hostclass.rb', line 12 def instantiate(modname) new_class = Puppet::Resource::Type.new(:hostclass, @name, @context.merge(:module_name => modname)) new_class.ruby_code = @ruby_code if @ruby_code all_types = [new_class] if code code.each do |nested_ast_node| if nested_ast_node.respond_to? :instantiate all_types += nested_ast_node.instantiate(modname) end end end return all_types end |