method
enum_with_index
Ruby latest stable (v1_8_7_72)
-
1 note -
Class: Enumerable
enum_with_index()
public
Calls block with two arguments, the item and its index, for each item in enum.
hash = Hash.new %w(cat dog wombat).each_with_index {|item, index| hash[item] = index } hash #=> {"cat"=>0, "wombat"=>2, "dog"=>1}
Register or
log in
to add new notes.
yonosoytu -
August 23, 2008
0 thanks
Needs requiring 'enumerator' to work
This method needs that you
require 'enumerator'
for this method to be available.

