Permalink
Browse files

Avoid creating an extra hash

  • Loading branch information...
1 parent d97ba0d commit c1dadf3d62d39fa8b1d837b71a3831d4edb46e0a @carlosantoniodasilva carlosantoniodasilva committed Jul 31, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -246,11 +246,11 @@ def reject(*args, &block)
# 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

0 comments on commit c1dadf3

Please sign in to comment.