aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-01-06 06:23:24 -0500
committerGitHub <noreply@github.com>2017-01-06 06:23:24 -0500
commit98c6e4e56ca2a8f9f987e12815f7cdf66e5f1485 (patch)
tree8a8f2b725d92d6a6242a926f9e250ff698d1aa02 /activesupport/lib
parente482dce0ed35bed2ab556e95a9f9d1124d65fa15 (diff)
parentd97ba3447268f6c72ca545221a22714641d98325 (diff)
downloadrails-98c6e4e56ca2a8f9f987e12815f7cdf66e5f1485.tar.gz
rails-98c6e4e56ca2a8f9f987e12815f7cdf66e5f1485.tar.bz2
rails-98c6e4e56ca2a8f9f987e12815f7cdf66e5f1485.zip
Merge pull request #27392 from y-yagi/use_same_class_on_compact
ensure `#compact` of HWIDA to return HWIDA
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb
index d3f7b46e77..79e7feaf47 100644
--- a/activesupport/lib/active_support/hash_with_indifferent_access.rb
+++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -269,6 +269,10 @@ module ActiveSupport
dup.tap { |hash| hash.transform_values!(*args, &block) }
end
+ def compact
+ dup.compact!
+ end
+
# Convert to a regular hash with string keys.
def to_hash
_new_hash = Hash.new