From: Gregory Brown Date: 2008-12-11T11:23:47+09:00 Subject: Re: P shows object values, so can u put P and value in txt? On Wed, Dec 10, 2008 at 4:35 PM, Matthew Moss wrote: > By 'ri p', it was meant that you do that on the command-line. (Actually, > you'd want to type: 'ri Kernel#p') > > 'ri' provides documentation for Ruby classes/methods. > > If you run the command 'ri Kernel#p', you'll see that 'p' returns nil. So > you can't use it directly to write to a file. Have you tried 'to_s'? If the OP wants string output from what he sees with Kernel#p, Object#inspect should be used, not to_s >> [1,2,3].inspect => "[1, 2, 3]" >> [1,2,3].to_s => "123" This returns the same string that p will output to the console. -greg -- Technical Blaag at: http://blog.majesticseacreature.com Non-tech stuff at: http://metametta.blogspot.com "Ruby Best Practices" Book now in O'Reilly Roughcuts: http://rubybestpractices.com