In Files

Parent

PrettyPrint::GroupQueue

Public Class Methods

new(*groups) click to toggle source
 
               # File prettyprint.rb, line 329
def initialize(*groups)
  @queue = []
  groups.each {|g| enq g}
end
            

Public Instance Methods

delete(group) click to toggle source
 
               # File prettyprint.rb, line 355
def delete(group)
  @queue[group.depth].delete(group)
end
            
deq() click to toggle source
 
               # File prettyprint.rb, line 340
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) click to toggle source
 
               # File prettyprint.rb, line 334
def enq(group)
  depth = group.depth
  @queue << [] until depth < @queue.length
  @queue[depth] << group
end
            

Commenting is here to help enhance the documentation. For example, sample code, or clarification of the documentation.

If you are posting code samples in your comments, please wrap them in "<pre><code class="ruby" > ... </code></pre>" markup in order to get syntax highlighting.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file a bug report so that it can be corrected for the next release. Thank you.

blog comments powered by Disqus