bpettichord / gmail.com wrote:
> One of my common idioms is to take a WIN32OLE object that implements
> the IEnumerable interface and extend it with the Ruby Enumerable Mix
> in. Thus:
> ...
> It strikes me that it might be reasonable to expect the Ruby win32ole
> library to do this for me automatically. Do you agree?

Yes, I've expected that on occasion, and I think it would be a nifty
feature indeed. Enumerable's methods don't clash with common COM
collection methods, as far as I can see.

The reason it's not included already is that each is called as
dynamically as any other OLE method; it's not determined before the call
whether or not the object actually implements IEnum. So either you'd
have to do this check on instantiation (probably in ole_set_member(),
the function that associates a WIN32OLE object with its COM object), or
you could include Enumerable in WIN32OLE itself.

I'm not sure how expensive it would be in terms of performance, adding
this check to ole_set_member().

Masaki Suketa?

Cheers,
Dave