From: Michael Granger Date: 2003-08-15T14:30:30+09:00 Subject: Re: common constructor idioms On Tuesday, August 12, 2003, at 11:49 AM, Dave Thomas wrote: >> class MyClass >> def initialize(x) >> if x.class == MyClass then >> #some code to duplicate stuff in x >> else >> #potentially other initialization mechanisms here >> end >> end >> end [snip] > ...or... I'd simply implement an instance method to duplicate a > particular object. Or just implement the copy constructor and use #dup or #clone: class MyClass def initialize_copy( x ) # Some code to duplicate stuff in x end end -- Michael Granger Rubymage, Believer, Architect The FaerieMUD Consortium