Builtin objects namespace

E

Eric Anderson

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?
 
G

gabriele renzi

il 27 Jul 2003 14:08:17 -0700, (e-mail address removed)
(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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top