>why do you need to say 'it is hash like' ? >Wo'nt it be easyer to say 'I need this methods, so I'll just check >them' ? > >BTW, probably the simpler solution is : > >x.methods =={}.methods >:) > > This is even worse than object.kind_of(Hash). The whole point of "duck typing" (as I understand it) is that you don't check if an object has certain methods. You just use them. Ruby will throw an error if there's a problem. The only case where it is advisable to use a form of :responds_to is when you want to have different functionality based on the kind of object that was passed in. A good use of this concept uses as few checks as possible to determine the "kind" (I'm using the term loosely here) of object. Perhaps the question you should be asking if you have one method that does multiple things based of the "kind" of object is, is your design is flawed? Perhaps your objects themselves should know how to do whatever operation your method that does multiple things does. -- John