Project

General

Profile

Actions

Bug #13306

closed

[DOC] rdoc for IO#puts

Added by stomar (Marcus Stollsteimer) about 7 years ago. Updated over 6 years ago.

Status:
Closed
Target version:
-
[ruby-core:80081]

Description

@naruse (Yui 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 --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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0