"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

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -

Python __call__ special method practical example -