On Jul 30, 2012, at 6:59 PM, trans (Thomas Sawyer) <transfire / gmail.com> =
wrote:

>=20
> Issue #6808 has been updated by trans (Thomas Sawyer).
>=20
>=20
>> There is no such index internal to Enumerator to make accessible.
>=20
> It not about Enumerator, its about #each itself. And there certainly =
is and index with #each method itself. e.g. =
https://github.com/ruby/ruby/blob/trunk/array.c#L1549

But that's only each for arrays.  I doubt an each method for, say, =
linked lists would bother to implement an internal index.

> #each_with_index doesn't cut it at all, as it doesn't address all the =
other possibilities, #map_with_index, #select_with_index, etc., which is =
the point.

I'm not clear why the #with_index method isn't adequate for your needs.

[1,2,3].map.with_index { |item, index| [item, index] }

--=20
-- Jim Weirich
-- jim.weirich / gmail.com