I wanted to create a MultiMap so for a key it stores not a single value
but an Array. The code is like that:
class MultiMap < Hash
def store (key, value)
if !super[key]
dat = Array.new
super[key]=dat #*
end
super[key].push(value)
end
For some reason it doesn’t work. I found by logging that even after line
- if I call super[key] I still get nil. What’s wrong with the code?