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

ruby-changes:36666

From: hsbt <ko1@a...>
Date: Tue, 9 Dec 2014 20:24:57 +0900 (JST)
Subject: [ruby-changes:36666] hsbt:r48747 (trunk): * string.c: [DOC] Add missing documentation around String#chomp.

hsbt	2014-12-09 20:24:46 +0900 (Tue, 09 Dec 2014)

  New Revision: 48747

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

  Log:
    * string.c: [DOC] Add missing documentation around String#chomp.
      Patchby @stderr [ci skip][fix GH-780]

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48746)
+++ ChangeLog	(revision 48747)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec  9 20:24:41 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* string.c: [DOC] Add missing documentation around String#chomp.
+	  Patchby @stderr [ci skip][fix GH-780]
+
 Tue Dec  9 18:20:02 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* object.c: [DOC] Revise documentation by Marcus Stollsteimer at
Index: string.c
===================================================================
--- string.c	(revision 48746)
+++ string.c	(revision 48747)
@@ -7161,15 +7161,18 @@ rb_str_chomp_bang(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/string.c#L7161
  *  from the end of <i>str</i> (if present). If <code>$/</code> has not been
  *  changed from the default Ruby record separator, then <code>chomp</code> also
  *  removes carriage return characters (that is it will remove <code>\n</code>,
- *  <code>\r</code>, and <code>\r\n</code>).
+ *  <code>\r</code>, and <code>\r\n</code>). If <code>$/</code> is an empty string,
+ *  it will remove all trailing newlines from the string.
  *
- *     "hello".chomp            #=> "hello"
- *     "hello\n".chomp          #=> "hello"
- *     "hello\r\n".chomp        #=> "hello"
- *     "hello\n\r".chomp        #=> "hello\n"
- *     "hello\r".chomp          #=> "hello"
- *     "hello \n there".chomp   #=> "hello \n there"
- *     "hello".chomp("llo")     #=> "he"
+ *     "hello".chomp                #=> "hello"
+ *     "hello\n".chomp              #=> "hello"
+ *     "hello\r\n".chomp            #=> "hello"
+ *     "hello\n\r".chomp            #=> "hello\n"
+ *     "hello\r".chomp              #=> "hello"
+ *     "hello \n there".chomp       #=> "hello \n there"
+ *     "hello".chomp("llo")         #=> "he"
+ *     "hello\r\n\r\n".chomp('')    #=> "hello"
+ *     "hello\r\n\r\r\n".chomp('')  #=> "hello\r\n\r"
  */
 
 static VALUE

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

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