Bug #4307: include fails after undef_method
http://redmine.ruby-lang.org/issues/show/4307

Author: Adriano Mitre
Status: Open, Priority: Normal
Category: core, Target version: 1.9.2
ruby -v: ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]

After using #undef_method on a method "inherited" from a mixin, reincludi=
ng the mixin should redefine it, but that is not what happens.

Please take a look at this short IRB transcript (source attached):

>> module Foo; def foo; 42; end; end
=3D> nil
>> Array.class_eval { include Foo }
=3D> Array
>> [1].foo
=3D> 42
>> Array.class_eval { Foo.instance_methods.each {|m| self.class_eval { un=
def_method m } } }
=3D> [:foo]
>> [1].foo
NoMethodError: undefined method `foo' for [1]:Array
	from (irb):5
	from /home/adriano/.rvm/rubies/ruby-1.9.2-p136/bin/irb:16:in `<main>'
>> Array.class_eval { include Foo }
=3D> Array
>> [1].foo
NoMethodError: undefined method `foo' for [1]:Array
	from (irb):7
	from /home/adriano/.rvm/rubies/ruby-1.9.2-p136/bin/irb:16:in `<main>'

The last command should just return 42, instead of raising a NoMethodErro=
r exception.

Note that this also applies to the following Ruby implementations:
  * ruby 1.8.7 (2010-12-23 patchlevel 330) [x86_64-linux]
  * rbx-1.2.0-20101221 [ ]
  * jruby-1.5.6 [ amd64-java =


Thus, it may be a language specification gap, not just an implementation =
bug.


----------------------------------------
http://redmine.ruby-lang.org
bW9kdWxlIEZvbzsgZGVmIGZvbzsgNDI7IGVuZDsgZW5kCkFycmF5LmNsYXNz
X2V2YWwgeyBpbmNsdWRlIEZvbyB9ClsxXS5mb28KQXJyYXkuY2xhc3NfZXZh
bCB7IEZvby5pbnN0YW5jZV9tZXRob2RzLmVhY2gge3xtfCBzZWxmLmNsYXNz
X2V2YWwgeyB1bmRlZl9tZXRob2QgbSB9IH0gfQpbMV0uZm9vCkFycmF5LmNs
YXNzX2V2YWwgeyBpbmNsdWRlIEZvbyB9ClsxXS5mb28KCg==