David Jacobs wrote in post #998093:
> I think the lookup starts at the innermost scope but since All isn't
> defined
> in Not, it reaches the top-level.

Yes, you are right:

1)
===
Constants defined within a class or module may be accessed unadorned 
anywhere within the class or module.

(Programming Ruby)
===

2)
===
Constants declared outside of a class or module are assigned global 
scope.

(http://www.techotopia.com/index.php/Ruby_Variable_Scope#Ruby_Constant_Scope)
===

So it's a case of the inner All hiding the global All.  And you can use 
the :: prefix to leap over an inner scope constant that hides a toplevel 
constant:

class All
  def greet
    puts 'All#greet'
  end
end

module C
  class All
     def greet
       puts "C::All#greet"
     end
  end

  class Dog
    def do_stuff
      ::All.new.greet  #<*****
    end
  end

end

C::Dog.new.do_stuff

--output:--
All#greet

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