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:

<snippet>

class A
 
  class << self
    class B
    end
 
    def testme1
      puts B # prints #<Class:0xac6598>::B
    end
  end
 
  def self.testme2
    puts B # raises a NameError
  end
 
end

A.testme1
A.testme2

</snippet>

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