From: Mikael Larsson Date: 2002-02-26T03:45:48+09:00 Subject: Re: Newbie question Hi! Thanks for your answer, that help me. About the book, I have allready orderd "The Ruby way". I dont know if it is a good book, some people seams to like it. /Mike ----- Original Message ----- From: "Alan Chen" To: "ruby-talk ML" Sent: Sunday, February 24, 2002 8:08 PM Subject: Re: Newbie question > On Sun, Feb 24, 2002 at 08:20:13PM +0900, Mikael Larsson wrote: > > Hi! > > > > This is a even a more newbie*newbie question. > > what does the "p" stands for? > > > # Based on same tsd.txt file as last time: > > > t = TSDB.new("tsd.txt") > > > p t[1]["field1"] # "one" > > > p t[2]["field2"] # "orange" > > Is it a short name for "puts" or what? > > > > Mike > > > > p calls an object's inspect method. It's meant for debugging/diagnostic use. > The nice part about p is that you can write your own inspect method for > your classes and objects. > > >From "Programming Ruby": (A book I'd highly recommend purchasing if you think that you're going to be using ruby) > > For each object, directly writes an Object.inspect followed by the > current output record separator to the program's standard output. p > bypasses the Ruby I/O libraries. > > -- alan > > -- > Alan Chen > Digikata LLC > http://digikata.com