From: Eric Anderson Date: 2004-12-21T02:27:20+09:00 Subject: Re: Convert one object to another Tim Hunter wrote: > I have two objects, big and little. I need to convert big to little. Big and > little don't have much in common except little's instance variables are a > subset of big's. That is, to convert big to little I need to copy the > instance variables they have in common. What's the right way to do this? > Should I add a "to_little" instance method to big's class, or should I add > a "from_big" singleton method to little's class? Neither one seems right. You could do both (TIMTOWTDI) but I would lean towards to_little. It matches the existing Ruby library. For example the to_s() methods, or the String object's to_i() method. I think there are also to_a() for converting to arrays in some objects. Just my 2 cents, Eric