Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Ruby has Enumerator#with_index(offset = 0). To, so first convert the array to an enumerator, use using Object#to_enum or Array#map, whatever feels more declarative to you:
[:a, :b, :c].map.with_index(2).to_a #=> [[:a, 2], [:b, 3], [:c, 4]]
Ruby has Enumerator#with_index(offset = 0). To convert the array to an enumerator, use Object#to_enum or Array#map, whatever feels more declarative to you:
Ruby has Enumerator#with_index(offset = 0), so first convert the array to an enumerator using Object#to_enum or Array#map:
Ruby >= 1.9.3 has Enumerator#with_index(offset = 0). To convert the array to an enumerator, use Object#to_enum or Array#map, whatever feels more declarative to you:
Ruby >= 1.9.3 has Enumerator#with_index(offset = 0). To convert the array to an enumerator, use Object#to_enumObject#to_enum or Array#mapArray#map, whatever feels more declarative to you:
Object#to_enum
Array#map