"Ruby-ish" way of creating a new instance of a class with parameters from multiple arrays? -


what "ruby-ish" way of creating new instance of class parameters multiple arrays, @ same index location in arrays?

for example, i'm doing:

array1.each_with_index { |element, i|      myclass(element, array2[i], array3[i], array4[i]) } 

this works fine, don't feel ruby-ish. there way in ruby?

-- derek

[array1, array2, array3, array4].transpose.map{|args| myclass(*args)} 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -