From: Thiago Arrais Date: 2006-04-02T13:04:02+09:00 Subject: Re: Dynamic code generation On 4/1/06, Timothy Goddard wrote: > Firstly you confuse things too much by using the same name as an > instance and class method. I thought too, code just seems too cluttered. The effect I was trying to achieve was calling class methods from instances, but Ruby doesn't allow it. Maybe just calling class methods from instances is bad form. Anyway, your idea helped me to solve my problem. I don't think I will even need the class method anymore. define_method is exactly what I was looking for. By the way, we don't need to do the module thing. define_method can be called inside make_it_say directly, like this: ---- class Parent def self.make_it_say(message) define_method :say do message end end def say 'This is the default message' end end ---- Child and Parent code seem pretty clean to me now. Thanks. Cheers, Thiago Arrais