【发布时间】:2012-02-16 18:58:04
【问题描述】:
我想将一个值合并到Thor option hash。
如果我只使用合并我会得到一个错误,HashWithIndifferentAccess
我已阅读文档,但我很难理解如何使其工作。我想我希望这个问题能帮助我找到关于如何将值合并到这种哈希中的问题的答案,并了解如何阅读文档。
p options.inspect
#=> "{\"ruby\"=>\"/Users/work/.rbenv/versions/1.9.2-p290/bin/ruby\"}"
p options.merge!(:a => true)
#=> hash_with_indifferent_access.rb:26:in `[]=': can't modify frozen hash (RuntimeError)
【问题讨论】: