Imagine you have this code
module UserTesting class Test # Details about a simple test end class TestCases < Test::Unit::TestCase end end # => NameError: uninitialized constant UserTesting::Test::Unit
This will result in an error, since your test constant, available for the class you are creating, does not have a constant Unit in it. If you access it through :: it looks like a leading slash along the way.
There is also a special case for using them - you can evaluate your code in something other than the default root namespace, and you really need a double colon to refer to classes like :: Object (usually for their monkey) .
Julik
source share