Module lookup starting with "::"

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

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

thanks Jason, very clear explanation.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs