method
collect
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
collect()
public
Register or
log in
to add new notes.
noniq -
March 18, 2010 - (v1_8_6_287 - v1_8_7_72)
MattStopa -
March 11, 2012
![Default_avatar_30](https://www.gravatar.com/avatar/c03fdc9fc1f107225b664934e5ff5965?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks
collect_with_index
Use Object#enum_for if you need to collect with index:
require 'enumerator' %w{foo bar}.enum_for(:each_with_index).collect do |item, index| "#{index}: #{item}" end
See also: Enumerable#each_with_index
![Default_avatar_30](https://www.gravatar.com/avatar/bf2741e5fba213cd501b0c64fdffad3f?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks