From: Paolino Date: 2005-09-28T20:36:37+09:00 Subject: Re: Object private methods ts wrote: >>>>>>"P" == Paolino writes: > > > P> But why/how private messages are not accepting a receiver ? > P> Is this their actual definition? > > yes, > > P> I suppose 'main' does some tricks when I define a method "there". > > no, not really. ruby has self and *internally* ruby_class which give it > where the method must be defined. > > For example : > > * at top level it has : self = main, ruby_class = Object > > when you define a method at top level this will be an Object method > > * in the class A, it has : self = A, ruby_class = A > > when you define a method in A, this will be an instance method for A > This is the first bad hack I meet in the Ruby machine. Wasn't enough to operate inside a singleton and define a method_added hook to paste the added method in Object private space? Anyway thanks a lot for explanations . Paolino ___________________________________ Yahoo! Messenger: chiamate gratuite in tutto il mondo http://it.messenger.yahoo.com