aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorArthur Nogueira Neves <github@arthurnn.com>2015-04-19 09:53:19 -0700
committerArthur Nogueira Neves <github@arthurnn.com>2015-04-19 09:53:19 -0700
commit4e141f16ecc9c442772e361cb526d9b381b1c93e (patch)
treede21b13bcafb3d99cfaefb1b764a5ef26a3bca24 /activesupport/lib
parent0ff87595f0458a4ba01df27233c3ecb4000f2501 (diff)
parentc94577dd5c349a53e85eca1913cfbf1efe0e7eb9 (diff)
downloadrails-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 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/array/wrap.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb
index 10c5e2535d..b611d34c27 100644
--- a/activesupport/lib/active_support/core_ext/array/wrap.rb
+++ b/activesupport/lib/active_support/core_ext/array/wrap.rb
@@ -15,12 +15,13 @@ class Array
#
# * If the argument responds to +to_ary+ the method is invoked. <tt>Kernel#Array</tt>
# moves on to try +to_a+ if the returned value is +nil+, but <tt>Array.wrap</tt> returns
- # +nil+ right away.
+ # 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, <tt>Kernel#Array</tt>
# raises an exception, while <tt>Array.wrap</tt> does not, it just returns the value.
- # * It does not call +to_a+ on the argument, but returns an empty array if argument is +nil+.
+ # * 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 second point is easily explained with some enumerables:
+ # The last point is easily explained with some enumerables:
#
# Array(foo: :bar) # => [[:foo, :bar]]
# Array.wrap(foo: :bar) # => [{:foo=>:bar}]