From: sto.mar@...
Date: 2017-03-19T21:36:03+00:00
Subject: [ruby-core:80239] [Ruby trunk Bug#13306] [DOC] rdoc for IO#puts
Issue #13306 has been updated by stomar (Marcus Stollsteimer).
I very much think the _output_ record separator was meant, and I suggest the following:
``` diff
diff --git a/io.c b/io.c
index cd615fb..fabd5d5 100644
--- a/io.c
+++ b/io.c
@@ -7185,15 +7185,17 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
* call-seq:
* ios.puts(obj, ...) -> nil
*
- * Writes the given object(s) to ios as with IO#write
.
+ * Writes the given object(s) to ios.
* 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"])
*
* produces:
*
@@ -7201,6 +7203,9 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
* is
* a
* test
+ *
+ * Note that +puts+ always uses newlines and is not affected
+ * by the output record separator ($\\
).
*/
VALUE
--
1.9.1
```
Since the record separator is of no use here, IMO it doesn't make sense to mention "English"; furthermore, the other methods of IO also only mention the "non-English" forms.
I'll apply in a couple of days unless there are objections.
----------------------------------------
Bug #13306: [DOC] rdoc for IO#puts
https://bugs.ruby-lang.org/issues/13306#change-63677
* Author: stomar (Marcus Stollsteimer)
* Status: Open
* Priority: Normal
* Assignee: naruse (Yui NARUSE)
* Target version:
* ruby -v: head
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
@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 ios as with IO#write
.
+ * Writes the given object(s) to ios.
* 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"])
*
* produces:
*
--
1.9.1
```
--
https://bugs.ruby-lang.org/
Unsubscribe: