diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-05-01 15:36:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 15:36:49 -0500 |
commit | b8f88b961092b6b289d18017ab72f3958a315b1d (patch) | |
tree | fa978b7021a06c72399870b2320b2eb935190e9b /activesupport/lib | |
parent | cc760e9106404f73ae682f67806e23f36d22add3 (diff) | |
parent | 75a2ca6e9dca2c36d80478bcc78ac7bd25bf38f7 (diff) | |
download | rails-b8f88b961092b6b289d18017ab72f3958a315b1d.tar.gz rails-b8f88b961092b6b289d18017ab72f3958a315b1d.tar.bz2 rails-b8f88b961092b6b289d18017ab72f3958a315b1d.zip |
Merge pull request #34642 from azimux/improve-hwia-initialize-by-skipping-to_h-if-already-a-hash
HashWithIndifferentAccess#initialize performance improvement
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/hash_with_indifferent_access.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 42ae7e9b7b..5981763f0e 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -69,7 +69,7 @@ module ActiveSupport super() update(constructor) - hash = constructor.to_hash + hash = constructor.is_a?(Hash) ? constructor : constructor.to_hash self.default = hash.default if hash.default self.default_proc = hash.default_proc if hash.default_proc else |