There is no need for an index variable as you use. Just add each array to the test array:
irb> test = [] => [] irb> test << ["a", "b", "c"] => [["a", "b", "c"]] irb> test << ["d", "e", "f"] => [["a", "b", "c"], ["d", "e", "f"]] irb> test << ["g", "h", "i"] => [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"]] irb> test => [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"]]
source share