Method: Multimap#store
- Defined in:
- lib/multimap.rb
#store(key, value) ⇒ Object Also known as: []=
call-seq:
map[key] = value => value
map.store(key, value) => value
Associates the value given by value with the key given by key. Unlike a regular hash, multiple can be assoicated with the same value.
map = Multimap["a" => 100, "b" => 200]
map["a"] = 9
map["c"] = 4
map #=> {"a" => [100, 9], "b" => [200], "c" => [4]}
107 108 109 110 111 112 |
# File 'lib/multimap.rb', line 107 def store(key, value) update_container(key) do |container| container << value container end end |