aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJoel Turkel <jturkel@salsify.com>2019-07-24 17:47:40 -0400
committerJoel Turkel <jturkel@salsify.com>2019-07-24 17:53:03 -0400
commit93188101424d8f92b25c4bf5e6518d475cccf4e4 (patch)
treee6d787b46cdbcf84a38cce0a84bc05231d802765 /activesupport/lib
parentb1c27c059c88642aaf4a0c486320c03de4f165f6 (diff)
downloadrails-93188101424d8f92b25c4bf5e6518d475cccf4e4.tar.gz
rails-93188101424d8f92b25c4bf5e6518d475cccf4e4.tar.bz2
rails-93188101424d8f92b25c4bf5e6518d475cccf4e4.zip
Avoid hash allocation for HashWithIndifferentAccess#convert_value default options
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb4
1 files changed, 3 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 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