Hello I need a bit of help.
Here is what I want to do.
- Check if hash already has key based on a variable
- If key already exists add new value to key
- If key does not exists create new key and add new value to it
Here is what I got and it has many issues:
if @agencyList.has_key?(domain)
@agencyList[domain] << match
else
@agencyList[domain] = match
end
Thanks!
multimapgem. Then (assuming you use aMultimapinstance for@agencyList) you'd use@agencyList[domain] = matchto add an entry, in all cases.