mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
4dcd4069f5
commit
b30de6039d
2 changed files with 5 additions and 7 deletions
|
@ -1,3 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Refactor of Hash#symbolize_keys! to use Hash#replace. Closes #10420 [ReinH]
|
||||
|
||||
* Fix HashWithIndifferentAccess#to_options! so it doesn't clear the options hash. Closes #10419 [ReinH]
|
||||
|
||||
*2.0.1* (December 7th, 2007)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue