aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-12-08 00:19:37 +0000
committerRick Olson <technoweenie@gmail.com>2007-12-08 00:19:37 +0000
commitb30de6039d85d5d8239b9fc500d88f56d52c8d8d (patch)
treef29d1761765c2a4bd6e70a94b6fe7d169640003a /activesupport/lib
parent4dcd4069f577e2105ea25929be1350fcefb9f71d (diff)
downloadrails-b30de6039d85d5d8239b9fc500d88f56d52c8d8d.tar.gz
rails-b30de6039d85d5d8239b9fc500d88f56d52c8d8d.tar.bz2
rails-b30de6039d85d5d8239b9fc500d88f56d52c8d8d.zip
Refactor of Hash#symbolize_keys! to use Hash#replace. Closes #10420 [ReinH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8333 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/keys.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/keys.rb b/activesupport/lib/active_support/core_ext/hash/keys.rb
index 4d32a6b8a5..2bd4138be4 100644
--- a/activesupport/lib/active_support/core_ext/hash/keys.rb
+++ b/activesupport/lib/active_support/core_ext/hash/keys.rb
@@ -31,13 +31,7 @@ module ActiveSupport #:nodoc:
# Destructively convert all keys to symbols.
def symbolize_keys!
- keys.each do |key|
- unless key.is_a?(Symbol) || (new_key = key.to_sym).nil?
- self[new_key] = self[key]
- delete(key)
- end
- end
- self
+ self.replace(self.symbolize_keys)
end
alias_method :to_options, :symbolize_keys