From: Brian Candler Date: 2010-09-24T04:50:22+09:00 Subject: Re: Defining a class without opening an existent one Hagbard Celine wrote:0 > I want to define a class which happens to have the same name as a > builtin class. It shouldn't be a problem because it's in an extra > namespace, but Ruby opens the existing class instead of defining a new > one. Here's an example: > > module MyNamespace > class Array > # Some stuff > end > end That's fine. What makes you think that this didn't create a separate class? > I tried using the full qualifier (class MyNamespace::Array) but it > didn't help. In what way didn't it help? Did you get an error message? Post your full code and the exception. > Is there a possibility to actually define a new class? Sure, you've just done it :-) >> module MyNamespace; class Array; end; end => nil >> Array.object_id => 70098182563360 >> MyNamespace::Array.object_id => 70098182326040 >> a = MyNamespace::Array.new => # >> a[1] NoMethodError: undefined method `[]' for # from (irb):5 from :0 -- Posted via http://www.ruby-forum.com/.