"Ben Tilly" <ben_tilly / hotmail.com> 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