Brian Candler wrote: > On Sat, Apr 05, 2003 at 11:09:50PM +0900, Damphyr wrote: > >>Class Experiment >> def doMethod(nameofmethod) >> self.extend nameofmethod >> end >>end >> >>the above does not execute (I know, I tried :)) ) and it would be silly >>if it did (I guess I'm a bit silly for trying :) ). >>And that is what that >> >> very_clever_method_takes_string_returns_module(modulename) >> >>should do. > > > Ah - I thought you were going to return the module itself, not a string of > the module name. See Guy's response about const_get. And yes, I think I will subscribe to the belief that has Guy talk in Ruby almost exclusively :) > > Something else which might be useful in your toolbox is Kernel#autoload: Back to the manual...and back again. This is very interesting. Combining const_get, autoload and a couple of naming restrictions one can build some pretty flexible structures. It's nice that my initial enthusiasm about Ruby is being so handsomely rewarded - I guess this'll be one Saturday spent coding :))). Thanks guys (although my girlfriend probably will hate you all). V.- P.S. Guy says: Object.const_get("MyModule") and he's right. The reference in the PP book puts const_get in Module though - is there something hidden in there, or is it just an error in the reference? -- http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.