From: tduehr@... Date: 2014-10-08T03:39:53+00:00 Subject: [ruby-core:65505] [ruby-trunk - Feature #9112] Make module lookup more dynamic (Including modules into a module after it has already been included) Issue #9112 has been updated by Timur Duehr. Are you just looking for the following test to pass then for 2? ~~~ def test_simple_include obj = Object.new class << obj class A; def foo; 1; end; end module B; end class C < A; include B; def bar; foo; end; end $test_simple_include1 = C.new.bar module X; def foo; 2; end; end module B; include X; end $test_simple_include2 = C.new.bar module X; def foo; 3; end; end $test_simple_include3 = C.new.bar module B; def foo; 4; end; end $test_simple_include4 = C.new.bar end assert_equal(1, $test_simple_include1) assert_equal(2, $test_simple_include2) assert_equal(3, $test_simple_include3) assert_equal(4, $test_simple_include4) end ~~~ ---------------------------------------- Feature #9112: Make module lookup more dynamic (Including modules into a module after it has already been included) https://bugs.ruby-lang.org/issues/9112#change-49280 * Author: Tobias Pfeiffer * Status: Assigned * Priority: Normal * Assignee: Yukihiro Matsumoto * Category: core * Target version: ---------------------------------------- If a module (M) is included into a class (C) and afterwards another module (M2) is included into the first module (M) then C does not include M2 and instances do not respond to methods defined in M2. I think instances of C should respond to methods defined in M2 and C should include M2. I created a gist detailing the problem I have: https://gist.github.com/PragTob/7472643 I think this behavior is confusing, because if I'd reopen module M and just add methods there then instances of C can call those methods. However if I include another module in M then instances of C can not call those methods. Any opinions on if this would be a better behavior or why it isn't? (was unsure to file it as a bug or feature) -- https://bugs.ruby-lang.org/