From: Bryan Zarnett Date: 2001-07-14T20:36:34+09:00 Subject: [ruby-talk:17838] Re: Creating methods on the fly You could use the operation "send" on an object to invoke a method at runtime based on a name. If you want to create both the object and method at runtime you could: foo = Method.const_get("SomeClass").new foo.send("#{mySetMethod"}=",aValue) Just one example of course. Bryan >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. > >Feel free to point me at a section in the pickaxe book. --