aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-24 02:41:00 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-24 02:41:00 +0000
commit8c069d6d2ec20be3e1575594c79cfe63873dbd16 (patch)
tree3388ded9c22ca3bb758f145f4719ebe3534d6e12 /io.c
parent83471f115596c602da946af4899b84623fe81395 (diff)
downloadruby-8c069d6d2ec20be3e1575594c79cfe63873dbd16.tar.gz
[DOC] Improve example of IO#pread [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/io.c b/io.c
index 07f175db1b..f14e1440ca 100644
--- a/io.c
+++ b/io.c
@@ -5107,10 +5107,12 @@ pread_internal_call(VALUE arg)
* at end of file and <code>NotImplementedError</code> if platform does not
* implement the system call.
*
- * f = File.new("testfile")
- * f.read #=> "This is line one\nThis is line two\n"
- * f.pread(12, 0) #=> "This is line"
- * f.pread(9, 8) #=> "line one\n"
+ * File.write("testfile", "This is line one\nThis is line two\n")
+ * File.open("testfile") do |f|
+ * p f.read # => "This is line one\nThis is line two\n"
+ * p f.pread(12, 0) # => "This is line"
+ * p f.pread(9, 8) # => "line one\n"
+ * end
*/
static VALUE
rb_io_pread(int argc, VALUE *argv, VALUE io)