From: Chad Fowler Date: 2003-12-19T09:12:20+09:00 Subject: Re: How to return more than one result from a method? On Fri, 19 Dec 2003, Tim Hunter wrote: # I'm trying to code a method that has two result values. The values are # very different objects: an Image (a large and complicated object) and a # plain ol' Ruby Float. I'm not sure what the best way to handle this is. I # could return them an Array with 2 elements, but that feels too # lightweight. I could return a Hash with 2 members. I could define a new # class with two attributes, but that feels too heavyweight. I even thought # of having the method yield to a block, passing the two results as # arguments to the block, but that just seems bizarre. What does the Float represent? Perhaps there is a relationship between the two that would make a new type of class communicate better. My thought is (generally) that if you can't tie the two return values together in some kind of meaningful way, you may be doing more than one job in the method and you could split the method in two. That's just a heuristic of course. Can you explain what the method does a little more? Chad