From: dblack@... Date: 2003-02-05T10:37:40+09:00 Subject: Re: Is mixin possible with dynamic require? Hi -- On Wed, 5 Feb 2003, Jon Hurst wrote: > I need to dynamically require a file(module) from within a class. I then > need to mixin a method from this module. However, include doesn't seem to be > supported from within a method. I cannot place include outside of a method, > because the module has not yet been required. How can this be solved? I'm not sure exactly what you're trying to do. When you say dynamically require a file from within a class, do you mean something like this: class MyClass require 'something' end When you say "mixin a method from this module", I think you mean "mixin a module from this file" :-) Finally, is it possible you really want to extend the current object, rather than include it in the object's class? Something like: class MyClass require 'something' # contains SomeModule def my_method extend(SomeModule) end end This would add the methods in SomeModule to the current object. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav