From 13247fa4173321798df994dbcf154c74519e448b Mon Sep 17 00:00:00 2001 From: kazu Date: Sun, 24 Dec 2017 01:26:46 +0000 Subject: [PATCH] [DOC] Use File.open with block instead of File.new without close [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/io.c b/io.c index 1aa5a0e72a..07f175db1b 100644 --- a/io.c +++ b/io.c @@ -5175,10 +5175,11 @@ internal_pwrite_func(void *ptr) * Raises SystemCallError on error and NotImplementedError * if platform does not implement the system call. * - * f = File.new("out", "w") - * f.pwrite("ABCDEF", 3) #=> 6 + * File.open("out", "w") do |f| + * f.pwrite("ABCDEF", 3) #=> 6 + * end * - * File.read("out") #=> "\u0000\u0000\u0000ABCDEF" + * File.read("out") #=> "\u0000\u0000\u0000ABCDEF" */ static VALUE rb_io_pwrite(VALUE io, VALUE str, VALUE offset)