Tim Morgan wrote:
> In my Ruby script, I'd like to be able to hotswap classes. The best way
> I've found to do this thus far is with the Kernel.load method:
>
> load 'class_file.rb'
>
> It's not perfect -- it can't redefine constants, for instance, but it
> mostly works. The problem comes when my environment is somehow
> different, such that hotswapping the class is no longer an option.
> Let's say class_file.rb looks like this:
Try
Object.send :remove_const, :Name
Note that existing instances of Name won't be destroyed. You have to
create a new instance to work with the new stuff.
--
Posted via http://www.ruby-forum.com/.