From: Arlen Christian Mart Cuss Date: 2007-08-18T22:35:52+09:00 Subject: Named Constructor Idiom in Ruby? Hi all, I'm almost certain there's a good way to do this, but I seem to have lost hold of the thought of how -- is there a straight-forward/neat way to do the named constructor idiom in Ruby? In C++ terms, a class like this implements it: class A { public: static A something() { A a; // do something special to a return a; } static A otherthing() { A a; // some other special thing to a return a; } protected: A(); }; The result is that we can't construct A directly, only by one of the two 'named' constructors. Is there any way to achieve a similar thing using protection in Ruby? Thanks, Arlen.