Ruby bug?

DaZoner wrote:

Imagine you want to redefine a class at runtime. One way to do it is to
load a different class definition at runtime.

....

Using Ruby 1.8.1 the second printed line shows Bug to respond to both
method1 and method2 even though bug2.rb does not define method1. Is this a
bug?

This is Ruby working as designed. The 2nd file doesn't replace the Bug
class, it "opens" it for changes and adds a new method. All classes may be
opened and modified dynamically.

If you want to remove method1, look at undef_method or remove_method.