How about:

```ruby
v = yield e
a = h.fetch(v) { |v| h[v] = [] }
a << e
```

It doesn't appear that Ruby lets you clear out the hash.