From: furufuru@... (Ryo Furue) Date: 2001-08-18T16:18:38+09:00 Subject: [ruby-talk:19968] Re: "new" returning nil: how to report the failure of object creation Avi Bryant wrote in message news:... > On Fri, 17 Aug 2001, Ryo Furue wrote: > > > ....except for this problem: How should I prevent the user from calling > > MyClass.new? [...] > does this work? > > class MyClass > class << self > private :new > end > end It does, thank you! Your explanation has made me understand the "class << obj" thing, which I didn't. The notation "class << self" means "let me enter the class to which "self" belongs, that is, the metaclass of MyClass. Since we have made "new" a private method of the metaclass, we can call it only within the same object, MyClass. As a summary, I show my final (well, I hope this will really be the final) solution: class MyClass class <