Sha256: e4ab5d1dbab6476149fe84cac4c3a04bca8ba1919b6120cd7308e4aecda802e8

Contents?: true

Size: 1.19 KB

Versions: 85

Compression:

Stored size: 1.19 KB

Contents

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

    # 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)

      # 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
  end
end

Version data entries

85 entries across 85 versions & 4 rubygems

Version Path
puppet-3.0.0.rc4 lib/puppet/parser/ast/branch.rb
puppet-2.7.19 lib/puppet/parser/ast/branch.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/parser/ast/branch.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/lib/puppet/parser/ast/branch.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/parser/ast/branch.rb
puppet-2.7.18 lib/puppet/parser/ast/branch.rb
puppet-2.6.17 lib/puppet/parser/ast/branch.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/parser/ast/branch.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/parser/ast/branch.rb
puppet-2.7.17 lib/puppet/parser/ast/branch.rb
puppet-2.7.16 lib/puppet/parser/ast/branch.rb
puppet-2.7.14 lib/puppet/parser/ast/branch.rb
puppet-2.6.16 lib/puppet/parser/ast/branch.rb
puppet-2.7.13 lib/puppet/parser/ast/branch.rb
puppet-2.6.15 lib/puppet/parser/ast/branch.rb
supply_drop-0.9.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/parser/ast/branch.rb
supply_drop-0.8.1 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/parser/ast/branch.rb
supply_drop-0.8.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/parser/ast/branch.rb
puppet-2.7.12 lib/puppet/parser/ast/branch.rb
puppet-2.7.11 lib/puppet/parser/ast/branch.rb