From: James Edward Gray II Date: 2009-09-24T08:06:05+09:00 Subject: Re: How do you limit the line length of the output commands? Where is pqueue library documented? On Sep 23, 2009, at 4:59 PM, Mason Kelsey wrote: > There must be an easy way to solve the problem of controlling the > length of > the output line, forcing the rest into a line break. There's not really a built-in tool for this, no. > In the puts code > example below, I want to break between every 10 methods or just go > to a new > line after every 60 characters that get displayed so they don't run > off the > screen. > > First Question: What is an easy way to modify the below puts code to > control > line length without truncation? > > require "pqueue" > pq=PQueue.new(proc{|x,y| x[0][0] puts pq.methods.join(', ') # Displays the methods of PQueue Class Try this: require "pp" pp pg.methods > I've a tried puts, print, and p and they never do a word wrap or > such. Is > there a secret parameter for controlling the line length before word > wrap > occurs in these commands? The pp for "pretty print" library does account for things such as wrapping. > Second question: The pqueue library is not documented in > http://www.ruby-doc.org/stdlib/ . Is > there a > reason for that? The reason would be that it's not a standard library that ships with Ruby. You must have grabbed it from somewhere, so that's where you should look for documentation. Hope that helps. James Edward Gray II