ruby-changes:4371
From: ko1@a...
Date: Mon, 31 Mar 2008 00:39:14 +0900 (JST)
Subject: [ruby-changes:4371] yugui - Ruby:r15862 (trunk): * io.c (rb_io_lines, rb_io_bytes, rb_io_chars) Fixed their rdocs.
yugui 2008-03-31 00:39:00 +0900 (Mon, 31 Mar 2008) New Revision: 15862 Modified files: trunk/io.c Log: * io.c (rb_io_lines, rb_io_bytes, rb_io_chars) Fixed their rdocs. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=15862&r2=15861&diff_format=u Index: io.c =================================================================== --- io.c (revision 15861) +++ io.c (revision 15862) @@ -2301,14 +2301,18 @@ /* * call-seq: - * str.lines(sep=$/) => anEnumerator - * str.lines(limit) => anEnumerator - * str.lines(sep, limit) => anEnumerator + * ios.lines(sep=$/) => anEnumerator + * ios.lines(limit) => anEnumerator + * ios.lines(sep, limit) => anEnumerator * - * Returns an enumerator that gives each line in the string. + * Returns an enumerator that gives each line in <em>ios</em>. + * The stream must be opened for reading or an <code>IOError</code> + * will be raised. * - * "foo\nbar\n".lines.to_a #=> ["foo\n", "bar\n"] - * "foo\nb ar".lines.sort #=> ["b ar", "foo\n"] + * f = File.new("testfile") + * f.lines.to_a #=> ["foo\n", "bar\n"] + * f.rewind + * f.lines.sort #=> ["bar\n", "foo\n"] */ static VALUE @@ -2319,11 +2323,16 @@ /* * call-seq: - * str.bytes => anEnumerator + * ios.bytes => anEnumerator * - * Returns an enumerator that gives each byte in the string. - * - * "hello".bytes.to_a #=> [104, 101, 108, 108, 111] + * Returns an enumerator that gives each byte (0..255) in <em>ios</em>. + * The stream must be opened for reading or an <code>IOError</code> + * will be raised. + * + * f = File.new("testfile") + * f.bytes.to_a #=> [104, 101, 108, 108, 111] + * f.rewind + * f.bytes.sort #=> [101, 104, 108, 108, 111] */ static VALUE @@ -2340,8 +2349,10 @@ * The stream must be opened for reading or an <code>IOError</code> * will be raised. * - * f = File.new("testfile) - * f.chars.each {|c| print c, ' ' } + * f = File.new("testfile") + * f.chars.to_a #=> ["h", "e", "l", "l", "o"] + * f.rewind + * f.chars.sort #=> ["e", "h", "l", "l", "o"] */ static VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/