ruby-changes:49316
From: kazu <ko1@a...>
Date: Sun, 24 Dec 2017 10:26:51 +0900 (JST)
Subject: [ruby-changes:49316] kazu:r61433 (trunk): [DOC] Use File.open with block instead of File.new without close [ci skip]
kazu 2017-12-24 10:26:46 +0900 (Sun, 24 Dec 2017) New Revision: 61433 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61433 Log: [DOC] Use File.open with block instead of File.new without close [ci skip] Modified files: trunk/io.c Index: io.c =================================================================== --- io.c (revision 61432) +++ io.c (revision 61433) @@ -5175,10 +5175,11 @@ internal_pwrite_func(void *ptr) https://github.com/ruby/ruby/blob/trunk/io.c#L5175 * Raises <code>SystemCallError</code> on error and <code>NotImplementedError</code> * 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/