Forum: Ruby module lookup starting with "::"

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Py J. (Guest)
on 2009-05-04 04:09
hello, could anyone explain why sometimes a module is
referenced with "::" before its name? like in

::A::B::C

is it equivalent to the regular form "A::B::C"?

thanks
Jason R. (Guest)
on 2009-05-04 04:27
(Received via mailing list)
It's simply saying "do the lookup starting at the global scope and work
down" instead of "go up the scope hierarchy until you find what I'm
looking
for".
Useful in the case where you might have similarly named classes in
differing
scopes and need to specify exactly which class you want.

Jason
Py J. (Guest)
on 2009-05-04 04:43
thanks Jason, very clear explanation.
This topic is locked and can not be replied to.