[前][次][番号順一覧][スレッド一覧]

ruby-changes:24370

From: naruse <ko1@a...>
Date: Wed, 18 Jul 2012 04:07:32 +0900 (JST)
Subject: [ruby-changes:24370] naruse:r36421 (trunk): Add documentation about Array#join(nil). [Bug#5915]

naruse	2012-07-18 04:07:15 +0900 (Wed, 18 Jul 2012)

  New Revision: 36421

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36421

  Log:
    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.

  Modified files:
    trunk/array.c

Index: array.c
===================================================================
--- array.c	(revision 36420)
+++ array.c	(revision 36421)
@@ -1808,6 +1808,8 @@
  *
  *  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"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]