From: Arlen Christian Mart Cuss Date: 2007-09-28T21:05:41+09:00 Subject: Re: Making 'new' private in a C extension. On Fri, 2007-09-28 at 02:55 +0900, alterego@sdf.lonestar.org wrote: > Hello all, > > I'm writing a C extension, one of the classes I define can only be > instantiated via a defined 'get_instance' singleton method. This method will > only ever return one instance, that is, successive calls will always return > exactly the same ruby object. > > My problem is that someone could still call 'new' on the class. I'd like to > remove that possibility by making 'new' private. Unfortunately I can't for the > life of me work out how. > > Any help on this subject will be much appreciated. - Tom If it helps, you'd just do a "private :new" in the class -- see the other guy's response for what looks to be correct. I haven't written a C extension though, so I don't know how you'd do the equivalent. Good luck. :)