In Files

  • prettyprint.rb

Parent

PrettyPrint::GroupQueue

Public Class Methods

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

Public Instance Methods

delete(group) click to toggle source
 
               # File prettyprint.rb, line 339
def delete(group)
  @queue[group.depth].delete(group)
end
            
deq() click to toggle source
 
               # File prettyprint.rb, line 324
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 318
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, code samples, or clarification of the documentation.

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 bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus