Class: PrettyPrint::GroupQueue

Class | PrettyPrint::GroupQueue
In: | prettyprint.rb
Parent: | Object

### Methods

delete deq enq new

### Public Class methods

new(*groups)

[Source]

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

### Public Instance methods

delete(group)

[Source]

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

deq()

[Source]

    # File prettyprint.rb, line 342
        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

enq(group)

[Source]

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

[Validate]