From: Dave Thomas Date: 2001-03-04T10:38:45+09:00 Subject: [ruby-talk:11955] Re: singleton classes? "Ben Tilly" writes: > Can someone give me an example of how you would write a method that > extends an object and gives it a new method? (I kept on seeing > "nested method definition" warnings when I tried it the naive way.) Ben, Do you mean this, or are you looking for something more subtle that I'm (yet again) missing. def empower(anObj) def anObj.gotThePower? puts "I feeel the power" end end a = "downtrodden" empower(a) a.gotThePower? #=> I feeel the power Regards Dave