summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-17 19:07:15 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-17 19:07:15 +0000
commitba2ed2edebb1d86bc23e84a1f5168cf3fba94f84 (patch)
treebcdbb61337099452d1a7ff61fee509adda8ed2e5 /array.c
parent85dc1ab23b18ef7cb989eb4f4c704e8f8d30e12e (diff)
Add documentation about Array#join(nil). [Bug#5915]
We talked about this and it is like following: * maybe ary.join(nil) should always use empty string as a separator, but it disables to specify $, as a seprator through variables. * if nil means '', the conversion is to_s. to_s is not accepted. * nil is a special value, so special behavior is allowed. * use of $ variables is not recommended, so it is not worth to change current behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/array.c b/array.c
index 96746526e9..524553a119 100644
--- a/array.c
+++ b/array.c
@@ -1808,6 +1808,8 @@ rb_ary_join(VALUE ary, VALUE sep)
*
* Returns a string created by converting each element of the array to
* a string, separated by the given +separator+.
+ * If the +separator+ is +nil+, it uses current $,.
+ * If both the +separator+ and $, are nil, it uses empty string.
*
* [ "a", "b", "c" ].join #=> "abc"
* [ "a", "b", "c" ].join("-") #=> "a-b-c"