Use Array.each_with_index.map for 1.8.7

- Enumerator.with_index was added in 1.9.3