From: daz Date: 2005-11-07T00:17: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: > I think Daniel was, correctly, trying to limit his change to his own object. He didn't want to affect the class. Using 'Coo' in place of 'Complex' works as he would have expected: class Coo def angle 90 end end myc = Coo.new def myc.angle 88 end p myc.angle #-> 88 alt_myc = Coo.new # alternative-style definition to def myc.angle class << alt_myc def angle 22 end end p alt_myc.angle #-> 22 # Coo class remains unaffected c = Coo.new p c.angle #-> 90 Fortunately, the gurus stepped in with an explanation :-) daz