I am trying to cycle through all possible combinations of values stored in several arrays. To do this, I decided to put the array names into an array, then use permutation to build all possible combinations of the arrays, with the idea being I would then use the array-stored array names in an '.each do'
$arrays = ["$array1", "$array2", "$array3"]
$arrays.permutation(3).each do |val1,val2,val3|
val1.each do |step|
...check
val2.each do |step2|
...check2
val3.each do |step3|
...check3
end
end
end
end
However, you can't pass in an array name as a string. How can I make it work?