Ruby - Array multiplication or JOIN operation

arrays, ruby, set

Solution

Use the Array#product:

a = [1, 2]
b = [:a]
a.product(b)
=> [[1, :a], [2, :a]]

Problem

I have two arrays, ``` a = [1, 2] b = [:a] ``` I want to get the result as ``` [[1, :a], [2, :a]] ``` Is there any methods for this?

Original source