# PrettyPrint::GroupQueue (Class)

In: | prettyprint.rb
Parent: | Object

## Methods

delete deq enq new

## Public Class methods

new(*groups)

[Source]

    # File prettyprint.rb, line 328
        def initialize(*groups)
          @queue = []
          groups.each {|g| enq g}
        end

## Public Instance methods

enq(group)

[Source]

    # File prettyprint.rb, line 333
        def enq(group)
          depth = group.depth
          @queue << [] until depth < @queue.length
          @queue[depth] << group
        end

deq()

[Source]

    # File prettyprint.rb, line 339
        def deq
          @queue.each {|gs|
            (gs.length-1).downto(0) {|i|
              unless gs[i].breakables.empty?
                group = gs.slice!(i, 1).first
                group.break
                return group
              end
            }
            gs.each {|group| group.break}
            gs.clear
          }
          return nil
        end

delete(group)

[Source]

    # File prettyprint.rb, line 354
        def delete(group)
          @queue[group.depth].delete(group)
        end

[Validate]