diff options
Diffstat (limited to 'lib/puppet/parser/ast/branch.rb')
-rw-r--r-- | lib/puppet/parser/ast/branch.rb | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/puppet/parser/ast/branch.rb b/lib/puppet/parser/ast/branch.rb index 96d065e4c..73a2f674b 100644 --- a/lib/puppet/parser/ast/branch.rb +++ b/lib/puppet/parser/ast/branch.rb @@ -1,37 +1,37 @@ class Puppet::Parser::AST - # 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. - class Branch < AST - include Enumerable - attr_accessor :pin, :children + # 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. + class Branch < AST + include Enumerable + attr_accessor :pin, :children - # 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. - def each - @children.each { |child| - yield child - } - end + # 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. + def each + @children.each { |child| + yield child + } + end - # Initialize our object. Largely relies on the method from the base - # class, but also does some verification. - def initialize(arghash) - super(arghash) + # Initialize our object. Largely relies on the method from the base + # class, but also does some verification. + def initialize(arghash) + super(arghash) - # Create the hash, if it was not set at initialization time. - @children ||= [] + # 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 - } + # 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 + end end |