diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-30 15:39:00 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-30 15:39:00 +0000 |
commit | 70153a6a73e45a612921908f0f185b4b01d835da (patch) | |
tree | 1b3c365cad21b906a70d2639b022c3f9d93e77c8 /io.c | |
parent | ef260b085eea729efaa46e93ac71d08a3fa210c6 (diff) |
* io.c (rb_io_lines, rb_io_bytes, rb_io_chars) Fixed their rdocs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 35 |
1 files changed, 23 insertions, 12 deletions
@@ -2301,14 +2301,18 @@ rb_io_each_char(VALUE io) /* * 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 @@ rb_io_lines(int argc, VALUE *argv, VALUE io) /* * 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 @@ rb_io_bytes(VALUE io) * 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 |