From: Tilman Giese Date: 2008-07-11T21:58:55+09:00 Subject: [ruby-core:17740] Constant lookup within class methods Hi, I am stuck in some constant lookup behavior and I would really appreciate if someone could enlighten me what is going on. Here is the example: class A class << self class B end def testme1 puts B # prints #::B end end def self.testme2 puts B # raises a NameError end end A.testme1 A.testme2 I do not understand why those two class methods behave differently depending on how they were defined. It looks very confusing to me. Or is there an important reason for that? How does the constant lookup work in both examples? Thanks for your help. Best regards, Tilman