From: Farrel Lifson Date: 2002-10-02T17:25:06+09:00 Subject: Re: singleton methods with variable method names > obj = Object.new > methodName = 'foo' > methodDef = "def obj.#{methodName}; puts 'in my method'; end" > eval(methodDef) # to add the method foo to the object obj > obj.foo # to invoke it To be even more dynamic you can change obj.foo to obj.send('foo') Farrel -- |DNA Research Group mailto:flifson@cs.uct.ac.za |Dept. of Computer Science http://www.cs.uct.ac.za/~flifson |University of Cape Town +27-21-650-3127