Quoting Gennady Bystritksy <gfb / tonesoft.com>: > 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? > > 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. Ah! I didn't know that within a class definition (say Test) you can create objects with just "new" instead of "Test.new". Thanks! -- R. Mark Volkmann Partner, Object Computing, Inc.