aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/hash_with_indifferent_access.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2014-07-31 08:07:32 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2014-07-31 08:10:37 -0300
commitc1dadf3d62d39fa8b1d837b71a3831d4edb46e0a (patch)
tree10fe0dc6ce8e5d4c97c6642cc2cd6aadce5a4909 /activesupport/lib/active_support/hash_with_indifferent_access.rb
parentd97ba0d31bd10cd793649dbeb9e972edf3934fa7 (diff)
downloadrails-c1dadf3d62d39fa8b1d837b71a3831d4edb46e0a.tar.gz
rails-c1dadf3d62d39fa8b1d837b71a3831d4edb46e0a.tar.bz2
rails-c1dadf3d62d39fa8b1d837b71a3831d4edb46e0a.zip
Avoid creating an extra hash
Diffstat (limited to 'activesupport/lib/active_support/hash_with_indifferent_access.rb')
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb
index 30e27267a0..3d8f2d572b 100644
--- a/activesupport/lib/active_support/hash_with_indifferent_access.rb
+++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -246,11 +246,11 @@ module ActiveSupport
# Convert to a regular hash with string keys.
def to_hash
- _new_hash = {}
+ _new_hash = Hash.new(default)
each do |key, value|
_new_hash[key] = convert_value(value, for: :to_hash)
end
- Hash.new(default).merge!(_new_hash)
+ _new_hash
end
protected