From: Alan Chen Date: 2002-02-25T04:08:30+09:00 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