複数の配列の各インデックスの値をまとめる
Top > Ruby [2.2.2] > zip
p [1,2,3].zip(["Acha", "Porute", "Piipo"], [:Boo, :Foo, :Woo], [4, 5, 6, 7]) # [[1, "Acha", :Boo, 4], # [2, "Porute", :Foo, 5], # [3, "Piipo", :Woo, 6]] p (1..5).zip(["Acha", "Porute", "Piipo"], [:Boo, :Foo, :Woo], [4, 5, 6, 7]) # [[1, "Acha", :Boo, 4], # [2, "Porute", :Foo, 5], # [3, "Piipo", :Woo, 6], # [4, nil, nil, 7], # [5, nil, nil, nil]]