Merge pull request #36758 from jturkel/feature/hash-optimization
Avoid unnecessary hash allocation in HashWithIndifferentAccess#convert_value
This commit is contained in:
commit
706ee3eb49
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user