0
我想知道如何將散列添加到散列 上,並在內部增加散列。在散列或符號上動態添加散列紅寶石
words_to_scan.scan(/\w+|\?|\.|!|\,/).select do |aword|
if words_from_file.has_key?(aword.to_sym)
words_from_file[aword.to_sym]['pop'] += 1
else
words_from_file[aword.to_sym]['pop'] = 1
end
end
我試圖每當關鍵是不發現像
words_from_file = {:the => {'pop' => 3, 'positions' => [1,6,10]}}