From: "nobu (Nobuyoshi Nakada)" Date: 2012-12-29T11:46:23+09:00 Subject: [ruby-core:51178] [ruby-trunk - Bug #4502] strange Module.new behaviour Issue #4502 has been updated by nobu (Nobuyoshi Nakada). With latest version, A.X occurs NameError instead of returning B::X. ---------------------------------------- Bug #4502: strange Module.new behaviour https://bugs.ruby-lang.org/issues/4502#change-35130 Author: evilbrain (Andy Bogdanov) Status: Assigned Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: core Target version: 2.0.0 ruby -v: ruby 1.9.1p430 (2010-08-16 revision 28998) [i386-mingw32] =begin First I create a proc: p = proc { self::X = Class.new def self.X X.new end } Then I create a module: A = Module.new(&p) puts A.X # => # Then I create another module: B = Module.new(&p) puts B.X # => # Everything seems to be ok. But after module B was created (({A.X})) started to return instances of (({B::X})) puts A.X # => # When (({self::X.new})) is used instead of (({X.new})) everything works as expected. More info can be found here http://www.ruby-forum.com/topic/1275717 =end -- http://bugs.ruby-lang.org/