What does :: mean at the beginning?

Hi, looking at a Ruby code I've found this:

  repo = ::Logging::Repository.instance

What does the first :: mean?

Thanks.

···

--
Iñaki Baz Castillo

It's an "ensure you're pulling from the top level". Works exactly the
same as in C++

Jason

···

On Thu, Aug 21, 2008 at 4:41 PM, Iñaki Baz Castillo <ibc@aliax.net> wrote:

Hi, looking at a Ruby code I've found this:

repo = ::Logging::Repository.instance

What does the first :: mean?

Thanks.

--
Iñaki Baz Castillo

start a the 'top' namespace

class A
end

module M
   class A
   end

    p ::A # the top level one, not the normally scoped one
end

a @ http://codeforpeople.com/

···

On Aug 21, 2008, at 2:41 PM, Iñaki Baz Castillo wrote:

Hi, looking at a Ruby code I've found this:

repo = ::Logging::Repository.instance

What does the first :: mean?

Thanks.

--
we can deny everything, except that we have the possibility of being better. simply reflect on that.
h.h. the 14th dalai lama

Let me be sure:

module A
        CONS = "AAA"
        module B
                CONS = "BBB"
        end
end

module A
        module B
                puts ::a::CONS
        end
end

=> AAA

Is it?

Thanks a lot.

···

El Jueves, 21 de Agosto de 2008, Jason Roelofs escribió:

It's an "ensure you're pulling from the top level". Works exactly the
same as in C++

--
Iñaki Baz Castillo