views:

484

answers:

5

I'm trying to find info on the p method in Ruby. It seems to produce internal info on the properties of a class but when I try to search for it I get every word that has the letter p in it.

+9  A: 

Have you seen the api doc page? http://www.ruby-doc.org/core/classes/Kernel.html#M006002

DanSingerman
Cool. I didn't know it was in the Kernel. Thanks.
A: 

Do you need more than this?

http://www.ruby-doc.org/core/classes/Kernel.html#M006002

Ward Werbrouck
Thanks. Don't know my way around the docs yet.
+5  A: 

Each method you can call "directly", e.g: print, p, abort, puts, readline, etc., is located in the Kernel class.


(Kernel.methods - Object.methods).sort.each do |method|
   puts method
end
Geo
Ah! That makes sense then. Thank you.
+1  A: 

Do you mean like:

ri Kernel#p

Paul Hedderly
Cool. Didn't know you could do that. Thanks.
NP :O) Ruby is full of neat tricks...
Paul Hedderly
+2  A: 

RubyBrain is very useful, I find.

p method on RubyBrain.

ski