M
Mason Kelsey
[Note: parts of this message were removed to make it a legal post.]
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. 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]<y[0][0]})
puts pq.methods.join(', ') # Displays the methods of PQueue Class
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?
Second question: The pqueue library is not documented in
http://www.ruby-doc.org/stdlib/ <http://www.ruby-doc.org/>. Is there a
reason for that? Or is it cleverly hidden in a class that doesn't seem to
have anything to do with priority queues?
Thanks once more to the Ruby masters,
No Sam
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. 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]<y[0][0]})
puts pq.methods.join(', ') # Displays the methods of PQueue Class
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?
Second question: The pqueue library is not documented in
http://www.ruby-doc.org/stdlib/ <http://www.ruby-doc.org/>. Is there a
reason for that? Or is it cleverly hidden in a class that doesn't seem to
have anything to do with priority queues?
Thanks once more to the Ruby masters,
No Sam