Concatenate arrays items

Posted by j. on Stack Overflow See other posts from Stack Overflow or by j.
Published on 2010-03-31T13:41:12Z Indexed on 2010/03/31 13:43 UTC
Read the original article Hit count: 288

I have two arrays:

x = [ [0, "#0"], [1, "#1"] ]
y = [ [00, "00 description"], [10, "10 description"] ]

What i need is to merge them so i get the following as result:

result = [ [000, "#0 00 description"], [010, "#0 10 description"],
   [100, "#1 00 description"], [110, "#1 10 description"]]

Is there a method for that? Or I'll need to use collect or something like this?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails