aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorHendy Tanata <htanata@gmail.com>2014-02-28 11:28:24 -0800
committerHendy Tanata <htanata@gmail.com>2014-02-28 11:31:58 -0800
commitcee7a06746ef194c922f96209a876648b8be0d59 (patch)
treeda5257dc069f7c5e3f88142f5a7451dfc6df33cc /guides
parent245574ae02216fcf29c93c2a2fe2ca74c00ffc1f (diff)
downloadrails-cee7a06746ef194c922f96209a876648b8be0d59.tar.gz
rails-cee7a06746ef194c922f96209a876648b8be0d59.tar.bz2
rails-cee7a06746ef194c922f96209a876648b8be0d59.zip
Improve collision explanation for Hash#transform_keys.
Based on comments at https://github.com/rails/docrails/commit/42417b0013819e573be9ffc5402e179003156e8e#commitcomment-5527251 [skip ci]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_support_core_extensions.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index ad5c9d4466..5698dc0413 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -2719,7 +2719,7 @@ The method `transform_keys` accepts a block and returns a hash that has applied
# => {"" => nil, "A" => :a, "1" => 1}
```
-The result in case of key collision is not guaranteed:
+In case of key collision, one of the values will be chosen. The chosen value may not always be the same given the same hash:
```ruby
{"a" => 1, a: 2}.transform_keys { |key| key.to_s.upcase }
@@ -2761,7 +2761,7 @@ The method `stringify_keys` returns a hash that has a stringified version of the
# => {"" => nil, "a" => :a, "1" => 1}
```
-The result in case of key collision is not guaranteed:
+In case of key collision, one of the values will be chosen. The chosen value may not always be the same given the same hash:
```ruby
{"a" => 1, a: 2}.stringify_keys
@@ -2805,7 +2805,7 @@ The method `symbolize_keys` returns a hash that has a symbolized version of the
WARNING. Note in the previous example only one key was symbolized.
-The result in case of key collision is not guaranteed:
+In case of key collision, one of the values will be chosen. The chosen value may not always be the same given the same hash:
```ruby
{"a" => 1, a: 2}.symbolize_keys