diff options
author | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-24 01:26:46 +0000 |
---|---|---|
committer | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-24 01:26:46 +0000 |
commit | 13247fa4173321798df994dbcf154c74519e448b (patch) | |
tree | e326a4e5545184144da96e4ce5f7cde73532b51e /io.c | |
parent | 9fe26ef8de1ae047a4d775ce74878a0aeb01a19b (diff) |
[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
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -5175,10 +5175,11 @@ internal_pwrite_func(void *ptr) * 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) |