Merge pull request #36758 from jturkel/feature/hash-optimization

Avoid unnecessary hash allocation in HashWithIndifferentAccess#convert_value
This commit is contained in:
Rafael França 2019-07-25 14:25:50 -04:00 committed by GitHub
commit 706ee3eb49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -367,7 +367,9 @@ def convert_key(key) # :doc:
key.kind_of?(Symbol) ? key.to_s : key
end
def convert_value(value, options = {}) # :doc:
EMPTY_HASH = {}.freeze
def convert_value(value, options = EMPTY_HASH) # :doc:
if value.is_a? Hash
if options[:for] == :to_hash
value.to_hash