On Friday 04 June 2004 18:34, nobu.nokada / softhome.net wrote: > Hi, > > At Sat, 5 Jun 2004 10:13:44 +0900, > > Florian Gross wrote in [ruby-talk:102433]: > > > So, how do I positively identify when an object is a hash or at least > > > behaves like a hash? > > > > obj.respond_to?(:keys) # ? :) > > I'd prefer :each_pair. In both cases, does that mean that the object has hash-like functionality, or just that the object responds to those two methods? Is there some definition somewhere that says "it's a hash if it has these methods?" I actually have hash-like objects that DON'T respond to either of those two methods, but it would be easy enough to add fake ones. I hate adding fake methods just to id a hash interface, it's a kludge. Sean O'Dell