Builtin objects namespace

What namespace are the builtin objects? I want to create an object in
other module that has the same name and uses the builtin object. For
example, if I wanted to create a hash that operated in a "special"
manor. I would create:

module Special
class Hash < Builtin::Hash
end
end

But from what I can tell the builtin hash is not in a namespace. So
how do I do this?

“Eric Anderson” eric.anderson@sterlingpresence.com wrote in

What namespace are the builtin objects? I want to create an object in
other module that has the same name and uses the builtin object. For
example, if I wanted to create a hash that operated in a “special”
manor. I would create:

module Special
class Hash < Builtin::Hash
end
end

But from what I can tell the builtin hash is not in a namespace. So
how do I do this?

The ``Builtin’’ Namespace is called Object - so write
this as

···

module Special
class Hash < Object::Hash
end
# or more conviently
class Array < Array
end
end

puts Object::Hash == Hash # true
puts Special::Hash == Hash # false
puts Special::Array == Array # false

I think you can always refer to the root namespace with
::Class
I mean:
irb(main):001:0> module Special
irb(main):002:1> class Hash < ::Hash
irb(main):003:2> end
irb(main):004:1> end
=> nil

···

il 27 Jul 2003 14:08:17 -0700, eric.anderson@sterlingpresence.com (Eric Anderson) ha scritto::

What namespace are the builtin objects? I want to create an object in
other module that has the same name and uses the builtin object. For
example, if I wanted to create a hash that operated in a “special”
manor. I would create:

module Special
class Hash < Builtin::Hash
end
end

But from what I can tell the builtin hash is not in a namespace. So
how do I do this?

Use ::Hash to refer to the top level class.

Gennady.

···

On Tuesday, July 29, 2003, at 07:09 PM, Eric Anderson wrote:

What namespace are the builtin objects? I want to create an object in
other module that has the same name and uses the builtin object. For
example, if I wanted to create a hash that operated in a “special”
manor. I would create:

module Special
class Hash < Builtin::Hash
end
end

But from what I can tell the builtin hash is not in a namespace. So
how do I do this?