rails/rails — pull request #12611 by antonio (2013-10-23 09:02:42+00:00)
Title: Make slice! honor default hash value/proc

I ran yesterday into an issue that turned to be caused by `slice!` removing the
default proc from a hash. That is not consistent with how the bang methods in Hash
work normally.

I don't know if this is intended, here it is the fix just in case.

See below for an example:

```
[1] pry(main)> h1 = Hash.new { |h,k| h[k] = [] }
=> {}
[2] pry(main)> h1.update(a: 1, b: 2)
=> {:a=>1, :b=>2}
[3] pry(main)> h1[:c]
=> []
[4] pry(main)> h1.select! { |k, v| k == :a }
=> {:a=>1}
[5] pry(main)> h1
=> {:a=>1}
[6] pry(main)> h1[:c]
=> []
[7] pry(main)> h1.default_proc
=> #
[8] pry(main)> require 'active_support'
=> true
[9] pry(main)> h2 = Hash.new { |h, k| h[k] = [] }
=> {}
[10] pry(main)> h2.update(a: 1, b: 2)
=> {:a=>1, :b=>2}
[11] pry(main)> h2[:c]
=> []
[12] pry(main)> h2.slice!(:a)
=> {:b => 2, :c=>[]}
[13] pry(main)> h2
=> {:a=>1}
[14] pry(main)> h2[:c]
=> nil
[15] pry(main)> h2.default_proc
=> nil
```

Cheers