From: Greg Millam Date: 2005-08-02T04:31:45+09:00 Subject: Re: require each time new Use load() instead of require To get rid of old code, you might want to do something like I do. inside a particular 'module': class Foo < ScriptModule def initialize() ... register_command("foo") { |args| ... } end def cleanup unregister_command("foo") end end When I load() a script module, I attach all its class to its filename. When I want to reload said filename, I first call cleanup, causing it to unregister old code, etc, and then load() it again. - Greg manveru wrote: > hi to all, > > i卒m trying to build a irc-bot in ruby, and i卒ve no problem with that so > far. > but i卒m trying to minimize the need for a restart, and want to require > some external code at runtime. > i know there is require "external.rb", but this seems to work only once, > if i require a script twice while running the program and change it > meanwhile, it doesn卒t seem to use the changed code, and also i don卒t > know how i get rid of the last required code. > > that卒s yet another typical noob-question, i beg your pardon :) > btw, in case you didn卒t really understood what i need - the same thing > works in php with include("somescript.php") and that卒s exactly how i > want it to become. > > thx in advance > Michael Fellinger >