In my quest to master the fine art of duck typing / overloading, I’ve
run into this probem:
How can I identify a collection?
The problem is: String mixes in Enumerable, although it ain’t a
My method wants to act differently if it’s given a collection, then if
it’s just given a single object. I would check .respond_to? :each -
but String does, unfortunately.
Currently, I’m forced to do .kind_of? Array - but this ain’t duck
Any ideas? I’d like to separate Array, Hash, Set, etc. etc. from
single member objects.