Zip array of arrays to another array
Another way is:
arr1.zip(*arr2.transpose)
# => [["a", 1, "foo"], ["b", 2, "bar"], ["c", 3, "baz"]]
Here are two other (closely-related) ways:
enum = arr1.to_enum
arr2.map { |a| [enum.next].concat(a) }
#=> [["a", 1, "foo"], ["b", 2, "bar"], ["c", 3, "baz"]]
or
arr1_cpy = arr1.dup
arr2.map { |a| [arr1_cpy.shift].concat(a) }
#=> [["a", 1, "foo"], ["b", 2, "bar"], ["c", 3, "baz"]]