In message "Re: Why NameError ??" on Mon, 25 Aug 2008 17:54:00 +0900, Kyung won Cheon <kdream95@gmerce.co.kr> writes:
module M1
class A
end
end
module M2
class A
end
p A # M2::A
class B
p A # M2::A
end
end
module M3
include M1
p A # M1::A
class B
p A # NameError (M3::A)
end
end
Constant look-up goes self -> surrounding -> super (until Object).
So, from M3, look-up goes M3 -> M1 (A defined here). From M3::B,
B -> M3 -> Object (no A found).