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

ruby-changes:45991

From: stomar <ko1@a...>
Date: Thu, 23 Mar 2017 05:23:48 +0900 (JST)
Subject: [ruby-changes:45991] stomar:r58062 (trunk): io.c: [DOC] expand docs for IO#puts

stomar	2017-03-23 05:23:42 +0900 (Thu, 23 Mar 2017)

  New Revision: 58062

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

  Log:
    io.c: [DOC] expand docs for IO#puts
    
    [ruby-core:80081] [Bug #13306]

  Modified files:
    trunk/io.c
Index: io.c
===================================================================
--- io.c	(revision 58061)
+++ io.c	(revision 58062)
@@ -7185,15 +7185,17 @@ io_puts_ary(VALUE ary, VALUE out, int re https://github.com/ruby/ruby/blob/trunk/io.c#L7185
  *  call-seq:
  *     ios.puts(obj, ...)    -> nil
  *
- *  Writes the given object(s) to <em>ios</em> as with <code>IO#write</code>.
+ *  Writes the given object(s) to <em>ios</em>.
  *  Writes a newline after any that do not already end
- *  with a newline sequence.
+ *  with a newline sequence. Returns +nil+.
  *
+ *  The stream must be opened for writing.
  *  If called with an array argument, writes each element on a new line.
+ *  Each given object that isn't a string or array will be converted
+ *  by calling its +to_s+ method.
  *  If called without arguments, outputs a single newline.
- *  This doesn't affect $/. ($RS or $INPUT_RECORD_SEPARATOR in English.rb)
  *
- *     $stdout.puts("this", "is", "a", "test")
+ *     $stdout.puts("this", "is", ["a", "test"])
  *
  *  <em>produces:</em>
  *
@@ -7201,6 +7203,9 @@ io_puts_ary(VALUE ary, VALUE out, int re https://github.com/ruby/ruby/blob/trunk/io.c#L7203
  *     is
  *     a
  *     test
+ *
+ *  Note that +puts+ always uses newlines and is not affected
+ *  by the output record separator (<code>$\\</code>).
  */
 
 VALUE

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

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