Class: Puppet::Parser::AST::Branch
- Inherits:
-
Puppet::Parser::AST
- Object
- Puppet::Parser::AST
- Puppet::Parser::AST::Branch
- Includes:
- Enumerable
- Defined in:
- lib/vendor/puppet/parser/ast/branch.rb
Overview
The parent class of all AST objects that contain other AST objects. Everything but the really simple objects descend from this. It is important to note that Branch objects contain other AST objects only – if you want to contain values, use a descendent of the AST::Leaf class.
Direct Known Subclasses
ASTArray, ArithmeticOperator, BooleanOperator, CaseOpt, CaseStatement, CollExpr, Collection, ComparisonOperator, Else, Function, IfStatement, InOperator, MatchOperator, Minus, Not, Relationship, Resource, ResourceDefaults, ResourceInstance, ResourceOverride, ResourceParam, ResourceReference, Selector, Tag, VarDef
Constant Summary
Constants inherited from Puppet::Parser::AST
Constants included from Util::Docs
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#pin ⇒ Object
Returns the value of attribute pin.
Attributes inherited from Puppet::Parser::AST
Attributes included from Util::Docs
Instance Method Summary collapse
-
#each ⇒ Object
Yield each contained AST node in turn.
-
#initialize(arghash) ⇒ Branch
constructor
Initialize our 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(arghash) ⇒ Branch
Initialize our object. Largely relies on the method from the base class, but also does some verification.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vendor/puppet/parser/ast/branch.rb', line 22 def initialize(arghash) super(arghash) # Create the hash, if it was not set at initialization time. @children ||= [] # Verify that we only got valid AST nodes. @children.each { |child| unless child.is_a?(AST) raise Puppet::DevError, "child #{child} is a #{child.class} instead of ast" end } end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
8 9 10 |
# File 'lib/vendor/puppet/parser/ast/branch.rb', line 8 def children @children end |
#pin ⇒ Object
Returns the value of attribute pin.
8 9 10 |
# File 'lib/vendor/puppet/parser/ast/branch.rb', line 8 def pin @pin end |
Instance Method Details
#each ⇒ Object
Yield each contained AST node in turn. Used mostly by ‘evaluate’. This definition means that I don’t have to override ‘evaluate’ every time, but each child of Branch will likely need to override this method.
14 15 16 17 18 |
# File 'lib/vendor/puppet/parser/ast/branch.rb', line 14 def each @children.each { |child| yield child } end |