我想填充一个具有整数和散列的数组,例如:
my_a=[Integer,{}]
然后例如我试图拥有:
my_a[5,{:direction=>'up'}]
my_a[5,{:speed=>'fast'}]
my_a[3,{:direction=>'up'}]
my_a[3,{:speed=>'slow'}]
但我明白了
ArgumentError: wrong number of arguments(2 for 1)
如何使用 :direction => 'up' 将 my_a 设置为 5 的条目?
也许整个事情应该是一个哈希?
试图找到某种方式来存储它:
[0,{:top => ' ―― '},{:top_mid => '|__|'},{:bot_mid => '| |'},{:bot => '――'}]
[1,{:top => ' ―― '},{:top_mid => '|__|'},{:bot_mid => '| |'},{:bot => '――'}]
[2,{:top => ' ―― '},{:top_mid => '|__|'},{:bot_mid => '| |'},{:bot => '――'}]