diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-10-20 14:42:32 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-20 14:42:32 -0300 |
commit | 184cc703a272f6a9d835446a550137055e385a8c (patch) | |
tree | f546f8bbed4b75dfc2a9c25996803b7ba3e5ce2f | |
parent | 5741e87eea0b513aa2ec150507b973d0cef27ad4 (diff) | |
parent | 85dd85fe01a44a40a0363c6382382c35505522e0 (diff) | |
download | rails-184cc703a272f6a9d835446a550137055e385a8c.tar.gz rails-184cc703a272f6a9d835446a550137055e385a8c.tar.bz2 rails-184cc703a272f6a9d835446a550137055e385a8c.zip |
Merge pull request #26846 from brunofacca/patch-1
[ci skip] Fix return values of Hash Extensions examples
-rw-r--r-- | guides/source/active_support_core_extensions.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 60a6c37f82..70b04a9695 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2661,7 +2661,7 @@ The method `transform_keys` accepts a block and returns a hash that has applied ```ruby {nil => nil, 1 => 1, a: :a}.transform_keys { |key| key.to_s.upcase } -# => {"" => nil, "A" => :a, "1" => 1} +# => {"" => nil, "1" => 1, "A" => :a} ``` 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: @@ -2703,7 +2703,7 @@ The method `stringify_keys` returns a hash that has a stringified version of the ```ruby {nil => nil, 1 => 1, a: :a}.stringify_keys -# => {"" => nil, "a" => :a, "1" => 1} +# => {"" => nil, "1" => 1, "a" => :a} ``` 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: @@ -2745,7 +2745,7 @@ The method `symbolize_keys` returns a hash that has a symbolized version of the ```ruby {nil => nil, 1 => 1, "a" => "a"}.symbolize_keys -# => {1=>1, nil=>nil, :a=>"a"} +# => {nil=>nil, 1=>1, :a=>"a"} ``` WARNING. Note in the previous example only one key was symbolized. @@ -2822,7 +2822,7 @@ Ruby has built-in support for taking slices out of strings and arrays. Active Su ```ruby {a: 1, b: 2, c: 3}.slice(:a, :c) -# => {:c=>3, :a=>1} +# => {:a=>1, :c=>3} {a: 1, b: 2, c: 3}.slice(:b, :X) # => {:b=>2} # non-existing keys are ignored |