/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# returns: ["0: a", "1: b", "2: c"] %w(a b c).enum_for(:each_with_index).collect { |o, i| "#{i}: #{o}" }