method
collect
collect()
public
Register or
log in
to add new notes.
noniq -
March 18, 2010 - (v1_8_6_287 - v1_8_7_72)
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
MattStopa -
March 11, 2012
0 thanks