diff options
author | Antonio Santos <antonio@santosvelasco.com> | 2013-10-24 09:17:35 +0200 |
---|---|---|
committer | Antonio Santos <antonio@santosvelasco.com> | 2013-10-24 09:17:35 +0200 |
commit | f13fce617deb50c91fbe504af5af726ec8b5654d (patch) | |
tree | b16080abf1e8a3dcec50cf3d350381898f33df0b /activesupport/lib/active_support | |
parent | 80e90b0bd0b0cd50a186e314034d68182c045765 (diff) | |
download | rails-f13fce617deb50c91fbe504af5af726ec8b5654d.tar.gz rails-f13fce617deb50c91fbe504af5af726ec8b5654d.tar.bz2 rails-f13fce617deb50c91fbe504af5af726ec8b5654d.zip |
slice! should not remove default hash value/proc
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/slice.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb index 9fa9b3dac4..8ad600b171 100644 --- a/activesupport/lib/active_support/core_ext/hash/slice.rb +++ b/activesupport/lib/active_support/core_ext/hash/slice.rb @@ -26,6 +26,8 @@ class Hash keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true) omit = slice(*self.keys - keys) hash = slice(*keys) + hash.default = default + hash.default_proc = default_proc if default_proc replace(hash) omit end |