我正在尝试按照以下示例将哈希插入数组中:如何在 ruby 中制作动态多维数组?. 什么地方出了错?
@array = Array.new
test1 = {"key1" => "value1"}
test2 = {"key2" => "value2"}
test3 = {"key3" => "value3"}
@array.push(0)
@array[0] << test1
# ERROR: can't convert Hash into Integer
@array[0] << test2
@array.push(1)
@array[1] << test2
@array[1] << test3