Ruby 如何使用moneta存储嵌套的键值对

Ruby 如何使用moneta存储嵌套的键值对,ruby,Ruby,我想知道如何使用rubygem moneta存储嵌套的键值对。我试了一下: store = Moneta.new(:YAML,:file => 'data.yaml') store['key']['nestedKey'] = 'value' store.close 但我收到了以下错误消息: moneta-test.rb:5:in `[]=': string not matched (IndexError) from moneta-test.rb:5:in `<mai

我想知道如何使用rubygem moneta存储嵌套的键值对。我试了一下:

store = Moneta.new(:YAML,:file => 'data.yaml')
store['key']['nestedKey'] = 'value'
store.close
但我收到了以下错误消息:

moneta-test.rb:5:in `[]=': string not matched (IndexError)
        from moneta-test.rb:5:in `<main>'

我看你只能有一个密钥,但你可以存储一个散列。因此,这应该是可能的:

store['key'] = { 'nestedKey' => 'value' }

你能举一个关于嵌套键值对的例子吗?
store['key'] = { 'nestedKey' => 'value' }