From: Logan Capaldo Date: 2007-08-18T08:14:32+09:00 Subject: Re: Unloading (or unrequiring) a file On 8/17/07, Ari Brown wrote: > Hey all, > > I'm trying to dynamically load parts of code to make things and > methods available. > > The catch is that I'd also like to make those things and methods > UNavailable as well (or load something else in place of the original > loaded item). > > I know there's no Kernel#unload, so how can I achieve my goal? > As far as methods go there's remove_method and undef_method. For constants theres remove_const. An idea I've had was to fork, although that's a little heavy handed eg: ... code ... pid = fork do require 'this_will_go_away' but_so_will_this_var = ThisWillGoAway.new but_so_will_this_var.do_something end Process.wait pid p but_so_will_this_var # NameError > > Thanks, > aRi > -------------------------------------------| > Nietzsche is my copilot > > > >