From: Gennady Bystritksy Date: 2005-06-21T00:13:10+09:00 Subject: Re: preventing instantiation R. Mark Volkmann wrote: > > When I put the following in my class, it seems that even that class can't create > instances. > > private_class_method :new > > I'm confused. How can I create a few objects within the class and then prevent > other classes from creating additional instances? > > -- > R. Mark Volkmann > Partner, Object Computing, Inc. > When you declare :new private with private_class_method, the class itself CAN call method "new", as long as it is invoked without self: class Test def self.create(*args) self.new(*args) # does not work new(*args) # works !!! end end This is because by definition, you cannot specify a receiver when calling private methods. Hope this helps, Gennady.