How to ducktype a Hash?

Sean O'Dell [mailto:sean@celsoft.com]:

···

On Sunday 06 June 2004 05:38, Kristof Bastiaensen wrote:

Hm, just an idea, but perhaps is tagging not such an ugly
solution? You could create a dummy module Hashlike, include it in
your hashlike classes, and test with obj.is_a? Hashlike or
obj.is_a? Hash

It's a decent solution, I think. My only complaint is that I have
to hack it in, instead of the solution being something Ruby does
automatically for all classes.

Then perhaps the way that you're looking at the solution isn't
sufficiently "Ruby."

-austin
--
austin ziegler * austin.ziegler@evault.com

Or perhaps it's very Ruby and you don't realize it.

  Sean O'Dell

···

On Monday 07 June 2004 07:40, Austin Ziegler wrote:

Sean O'Dell [mailto:sean@celsoft.com]:
> On Sunday 06 June 2004 05:38, Kristof Bastiaensen wrote:
>> Hm, just an idea, but perhaps is tagging not such an ugly
>> solution? You could create a dummy module Hashlike, include it in
>> your hashlike classes, and test with obj.is_a? Hashlike or
>> obj.is_a? Hash
>
> It's a decent solution, I think. My only complaint is that I have
> to hack it in, instead of the solution being something Ruby does
> automatically for all classes.

Then perhaps the way that you're looking at the solution isn't
sufficiently "Ruby."