From: Dido Sevilla Date: 2008-09-25T01:48:42+09:00 Subject: Re: How to get Ruby objects printed out in their 'natural' form On Wed, Sep 24, 2008 at 12:49 AM, 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. p [1,2,3] puts [1,2,3].inspect The last is useful if you want to get the string representation of the Ruby object, e.g. if you're using a logger, so you can do something like: log.debug(obj.inspect) -- 普通じゃないのが当然なら答える私は何ができる? 普通でも普通じゃなくて感じるまま感じることだけをするよ! http://stormwyrm.blogspot.com