From: Gennady Bystritksy Date: 2005-06-21T00:31:26+09:00 Subject: Re: preventing instantiation R. Mark Volkmann wrote: >> >>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". Not just within class definition, rather from other class methods (mind "def self.create", sometimes written as "def Test.create", that starts definition of class method "create" for class "Test"). > > Thanks! You are welcome. > > -- > R. Mark Volkmann > Partner, Object Computing, Inc. >