From: Rick DeNatale Date: 2007-05-25T05:21:35+09:00 Subject: Re: temporary require ,is it possible? On 5/24/07, Joel VanderWerf wrote: > Brian Candler wrote: > > On Thu, May 24, 2007 at 06:03:22PM +0900, Gpy Good wrote: > >> I have a idea,it is "temporary require" > >> [code] > >> module Find > >> # my define > >> end > >> > >> tmp_require("find"){ > >> #do something with "Find.find" method,temporary!! > >> } > >> > >> puts Find # my define,no "Find.find" method > >> [/code] > >> Is it possible? > > > > Hmm, I was thinking of > > > > temp = load("find.rb", true) > > temp::Find.find(...) > > > > but unfortunately load returns true, not the module object :-( > > There's a way around that. See > > http://redshift.sourceforge.net/script/ > > No magic, just module_eval. > > (I'm not sure it solves the OP's problem, though.) Somehow this smells to me like a job for Why's sandbox. http://code.whytheluckystiff.net/sandbox/ -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/