Module lookup starting with "::"

hello, could anyone explain why sometimes a module is
referenced with “::” before its name? like in


is it equivalent to the regular form “A::b::C”?


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
Useful in the case where you might have similarly named classes in
scopes and need to specify exactly which class you want.


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