From 93188101424d8f92b25c4bf5e6518d475cccf4e4 Mon Sep 17 00:00:00 2001 From: Joel Turkel Date: Wed, 24 Jul 2019 17:47:40 -0400 Subject: Avoid hash allocation for HashWithIndifferentAccess#convert_value default options --- activesupport/lib/active_support/hash_with_indifferent_access.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 5981763f0e..bbb7c36382 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -367,7 +367,9 @@ module ActiveSupport 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 -- cgit v1.2.3