From: Thiago Arrais Date: 2006-04-02T13:15:38+09:00 Subject: Re: Dynamic code generation On 4/1/06, Logan Capaldo wrote: > I don;t see what you gain by meta-programming here I need a method to identify the child classes, something like Class#name, just more detailed. All instances of subclasses of the parent class need to respond to that method, but the method returns the same thing for all instances: a class identifier. Most classes will respond in mostly the same way, but some will need customization. Maybe a (almost) real example will help: ---- class Parent def identifier return "This is class #{self.class.name}" end end class ChildUsingDefaultIdentifier; end class ChildUsingCustomIdentifier def identifier return 'Instances of this class identify them on a totally different way' end end ---- Sure we could just override the method in the subclasses that needed to override it (like we did above), but it is just an identifier and a whole def block seemed too much. Regards, Thiago Arrais