From: "Thomas B." Date: 2008-09-24T02:04:37+09:00 Subject: Re: How to get Ruby objects printed out in their 'natural' f Kenneth McDonald wrote: > For debugging purposes, I'd like to be able to do something like > > print [1,2,3] > > and have "[1,2,3]" printed to the screen, not 123. How do I go about > this. I've experimented with to_s and puts, and not found anything > obvious. > > Thanks, > Ken Each object has method inspect and it does the trick. The irb in fact prints the result's inspect to show it to you. ["a",:b,3].inspect #=> "[\"a\", :b, 3]" TPR. -- Posted via http://www.ruby-forum.com/.