From: Nobuyoshi Nakada Date: 2007-09-29T03:39:05+09:00 Subject: Re: Making 'new' private in a C extension. Hi, At Fri, 28 Sep 2007 22:23:28 +0900, Paul Brannan wrote in [ruby-talk:271468]: > > 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. > > VALUE rb_cFoo = rb_define_class("Foo", rb_cObject); > rb_undef_alloc_func(rb_cFoo); It makes impossible to create any instances at all. rb_undef_method(rb_singleton_class(rb_cFoo), "new"); -- Nobu Nakada