HarryO wrote: > I would like to create a new method on the fly. Assuming I have a > variable containing the name I want to give the method, how can I create > it at runtime? > > I will need to stick the values of some other variables into the code for > the method, too. Try eval: methName = "myMethod" a = "test" eval %{ def #{ methName } ... end } which create method myMethod in the current class. You cannot access variables (e.g. "a") inside the method by name. To use it, you have to interpolate it's value into the string given to eval. Another possible solution is: class X def create def self.myMethod p "in myMethod" end end end x = X.new x.myMethod # => undefined method "myMethod" x.create x.myMethod # => "in myMethod" Regards, Michael -- Michael Neumann merlin.zwo InfoDesign GmbH http://www.merlin-zwo.de