From: Sean O'Halpin Date: 2005-11-07T06:00:57+09:00 Subject: Re: what does --can't define singleton method-- mean? On 11/6/05, daz wrote: > > Sean O'Halpin wrote: > > On 11/6/05, Daniel Sch�le wrote: > > > irb(main):014:0* class << Complex > > I think Daniel was, correctly, trying to limit his change > to his own object. He didn't want to affect the class. If you read what Daniel wrote: >> I would like to have the angle method >> to return the angle in degrees for each >> Complex instance, how can I achieve it >> the obvious didn't work for me and his subsequent message that Complex.class_eval does what he wants I think you will see that all he really wanted to do was to redefine the instance method for angle which is more usually done by re-opening class as I showed. All the singleton stuff is a bit of a red herring as far as Daniel is concerned. I would think that most people on this list would agree that this: > class Complex > def angle > arg/Math::PI*180.0 > end > end is the usual way to do this. Regards, Sean