I have two arrays,
a = [1, 2] b = [:a]
I want to get the result as
[[1, :a], [2, :a]]
Are there any methods for this?
Use Array # product :
a = [1, 2] b = [:a] a.product(b) => [[1, :a], [2, :a]]
You can also do it this way.
[a,b*a.size].transpose #=> [[1, :a], [2, :a]]