Issue #13306 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 2.2: REQUIRED, 2.3: DONE, 2.4: REQUIRED to 2.2: REQUIRED, 2.3: DONE, 2.4: DONE
ruby_2_4 r59808 merged revision(s) 57944,57977,58062.
----------------------------------------
Bug #13306: [DOC] rdoc for IO#puts
https://bugs.ruby-lang.org/issues/13306#change-66570
* Author: stomar (Marcus Stollsteimer)
* Status: Closed
* Priority: Normal
* Assignee: stomar (Marcus Stollsteimer)
* Target version:
* ruby -v: r58059
* Backport: 2.2: REQUIRED, 2.3: DONE, 2.4: DONE
----------------------------------------
@naruse
This would effectively revert your recent r57944, so please give ok for me to apply this patch.
I don't think the mention of IO#write (or IO#print) is necessary (implementation detail); instead I expanded the docs with some information copied from write/print, like e.g. mention of `to_s`.
And I do not understand at all how puts should have an effect on the input record separator, or why someone would assume it might have.
``` diff
diff --git a/io.c b/io.c
index f1cdc56..e727d0a 100644
--- a/io.c
+++ b/io.c
@@ -7181,15 +7181,17 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
* 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 <code>to_s</code> 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>
*
--
1.9.1
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>