Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
How do you limit the line length of the output commands? Where ispqueue library documented?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Patrick Okui, post: 4649332"] PP::pp has a width parameter, but in this case I think it'll print one method per line (not say 10 per line) if you did PP::pp pq.methods. If that doesn't satisfy you I'd guess you're stuck with stuffing the methods into the end of a buffer yourself. (sorry this feels more like C than ruby to this ruby newbie but I can't think of a simpler way) buffer = '' pq.methods.each do |m| if buffer.split("\n")[-1].to_s.length + m.length < 60 buffer << ((buffer.length > 0)? ", #{m}": "#{m}") else buffer << "\n#{m}" end end puts buffer I'm not sure how you got pqueue but in my case (to test this example) I had to install it as a gem i.e it's not distributed with my ruby (1.8.7). gem query -d -n pqueue gives [URL]http://death.rubyforge.org/[/URL] as the homepage so that's where I'd start looking. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
How do you limit the line length of the output commands? Where ispqueue library documented?
Top