From: James Britt Date: 2006-03-30T00:38:43+09:00 Subject: Re: Ruby Black Belt ts wrote: >>>>>>"J" == James Edward Gray writes: > > > J> Robert Dober was kind enough to point out that RDoc may have led me > J> astray here. You can call Kernel methods like class methods and they > J> do not show up in the list of instance_methods(). They are mixed > J> into Object though, right? Can someone clue me in here? > > a global function is a Kernel module function : this mean that it's a > *private* method (this is why #instance_methods don't display it) and a > public singleton method > > moulon% ruby -e 'module M def f() end; module_function :f end; p M.instance_methods' > [] > moulon% > > moulon% ruby -e 'module M def f() end; module_function :f end; p M.private_instance_methods' > ["f"] > moulon% > > moulon% ruby -e 'module M def f() end; module_function :f end; p M.singleton_methods' > ["f"] > moulon% http://www.ruby-doc.org/core/classes/Module.html#M000725 -- James Britt "A principle or axiom is of no value without the rules for applying it." - Len Bullard