/ Published in: Ruby
Expand |
Embed | Plain Text
# returns: ["0: a", "1: b", "2: c"] %w(a b c).enum_for(:each_with_index).collect { |o, i| "#{i}: #{o}" }
You need to login to post a comment.
inkdeep on 03/10/10
1 person have marked this snippet as a favorite
# returns: ["0: a", "1: b", "2: c"] %w(a b c).enum_for(:each_with_index).collect { |o, i| "#{i}: #{o}" }
You need to login to post a comment.