Thanks Gary for the explanation. I was hoping the self logic would have 
applied in this case since I feel this is the intuitive way to think 
about it...

Another question about class variables actually. My understanding of 
class variables lookup is that it is not different from the methods 
lookup. Indeed, an instance object look at its class's class variables 
and then go through superclass and module all the way up to BasicObject.

Now why does not it apply to Classes object:

===
class Class
  @@test = "test"
end

class B
  def self.print
    puts @@test
  end
end

B.print
===

In this case B.print fails with:

module.rb:7:in `print': uninitialized class variable @@test in B 
(NameError)
  from module.rb:11

Since B's class is Class that should be fine. Obviously I must be 
missing something here.

Thanks,
Jean-Pascal Billaud

-- 
Posted via http://www.ruby-forum.com/.