diff options
author | Arthur Nogueira Neves <github@arthurnn.com> | 2015-04-19 09:53:19 -0700 |
---|---|---|
committer | Arthur Nogueira Neves <github@arthurnn.com> | 2015-04-19 09:53:19 -0700 |
commit | 4e141f16ecc9c442772e361cb526d9b381b1c93e (patch) | |
tree | de21b13bcafb3d99cfaefb1b764a5ef26a3bca24 /guides | |
parent | 0ff87595f0458a4ba01df27233c3ecb4000f2501 (diff) | |
parent | c94577dd5c349a53e85eca1913cfbf1efe0e7eb9 (diff) | |
download | rails-4e141f16ecc9c442772e361cb526d9b381b1c93e.tar.gz rails-4e141f16ecc9c442772e361cb526d9b381b1c93e.tar.bz2 rails-4e141f16ecc9c442772e361cb526d9b381b1c93e.zip |
Merge pull request #19799 from yui-knk/fix/wrap_doc2
[ci skip] Fix docs and guide about 'Array.wrap'
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index fe2ab27a5a..2a643680f7 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2440,9 +2440,9 @@ Array.wrap(0) # => [0] This method is similar in purpose to `Kernel#Array`, but there are some differences: -* If the argument responds to `to_ary` the method is invoked. `Kernel#Array` moves on to try `to_a` if the returned value is `nil`, but `Array.wrap` returns `nil` right away. +* If the argument responds to `to_ary` the method is invoked. `Kernel#Array` moves on to try `to_a` if the returned value is `nil`, but `Array.wrap` returns an array with the argument as its single element right away. * If the returned value from `to_ary` is neither `nil` nor an `Array` object, `Kernel#Array` raises an exception, while `Array.wrap` does not, it just returns the value. -* It does not call `to_a` on the argument, though special-cases `nil` to return an empty array. +* It does not call `to_a` on the argument, if the argument does not respond to +to_ary+ it returns an array with the argument as its single element. The last point is particularly worth comparing for some enumerables: |