From: Jian Lin Date: 2010-05-20T05:57:03+09:00 Subject: Re: How to print out all of an object's instance variables? Jian Lin wrote: > require 'pp' works until inspect is redefined, then it will stop working > and give the following error. thanks for giving out starting pointers > though. on the other hand, if inspect() is to return a string representation, then 'pp' still works except it doesn't print out all the instance variables: irb(main):026:0> class Point irb(main):027:1> def inspect irb(main):028:2> "#@x #@y and i am a point" irb(main):029:2> end irb(main):030:1> end => nil irb(main):031:0> p => 1 2 and i am a point irb(main):032:0> p p 1 2 and i am a point => nil irb(main):033:0> pp p # note that @something is not printed out 1 2 and i am a point => nil irb(main):034:0> -- Posted via http://www.ruby-forum.com/.