From: "Daniel Schüle" Date: 2005-11-07T00:37:11+09:00 Subject: Re: what does --can't define singleton method-- mean? Sean O'Halpin wrote: > On 11/6/05, Daniel Sch�le wrote: > >>irb(main):014:0* class << Complex > > > You're using the wrong syntax here. To re-open a class, just use > normal class definition syntax: > > class Complex > def angle > arg/Math::PI*180.0 > end > end I found out that I also can use Complex.class_eval do def angle arg / Math::PI * 180 end end this would "update" the method for all instances of Complex class class << Complex def angle; "angle"; end end would create singleton_method for Complex class itself Complex.angle => "angle" what is the advantage or typical use of having singleton method for a class? I could imagine that since Complex is a Class it has some inherited methods from it .. and singleton method would belong only to Complex nevertheless I can't find scenarious where I could use it but I am a newbee thanks to all for your replies Daniel