1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c: Note that methods other than IO#gets may increase IO#lineno.

[Ruby 1.9 - Bug #4902]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-07-09 00:21:44 +00:00
parent dd2dfc71e7
commit 0c3833ec5a
2 changed files with 13 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Sat Jul 9 09:14:56 2011 Eric Hodel <drbrain@segment7.net>
* io.c: Note that methods other than IO#gets may increase IO#lineno.
[Ruby 1.9 - Bug #4902]
Sat Jul 9 08:39:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Jul 9 08:39:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (RUN_OPT): disable gems. * common.mk (RUN_OPT): disable gems.

13
io.c
View file

@ -2633,12 +2633,15 @@ rb_io_gets_m(int argc, VALUE *argv, VALUE io)
* call-seq: * call-seq:
* ios.lineno -> integer * ios.lineno -> integer
* *
* Returns the current line number in <em>ios</em>. The stream must be * Returns the current line number in <em>ios</em>. The stream must be
* opened for reading. <code>lineno</code> counts the number of times * opened for reading. <code>lineno</code> counts the number of times
* <code>gets</code> is called, rather than the number of newlines * #gets is called rather than the number of newlines encountered. The two
* encountered. The two values will differ if <code>gets</code> is * values will differ if #gets is called with a separator other than newline.
* called with a separator other than newline. See also the *
* <code>$.</code> variable. * Methods that use <code>$/</code> like #each, #lines and #readline will
* also increment <code>lineno</code>.
*
* See also the <code>$.</code> variable.
* *
* f = File.new("testfile") * f = File.new("testfile")
* f.lineno #=> 0 * f.lineno #=> 0