From: daz Date: 2005-11-07T08:22:11+09:00 Subject: Re: what does --can't define singleton method-- mean? Sean O'Halpin wrote: > 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 have one more related question ]] > >> 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. Yes, I was defending Daniel's possible intentions which were ambiguous before his follow-up message. I see now that in his second (related) question, he *was* wanting to affect the class and that that was the part you were responding to. > 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. > Now we're focused on instance methods, I think you're on safe ground ;) Simple misunderstanding -- no aggression intended. > Regards, > > Sean daz