* 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
Родитель dd2dfc71e7
Коммит 0c3833ec5a
2 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -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>
* common.mk (RUN_OPT): disable gems.

13
io.c
Просмотреть файл

@ -2633,12 +2633,15 @@ rb_io_gets_m(int argc, VALUE *argv, VALUE io)
* call-seq:
* 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
* <code>gets</code> is called, rather than the number of newlines
* encountered. The two values will differ if <code>gets</code> is
* called with a separator other than newline. See also the
* <code>$.</code> variable.
* #gets is called rather than the number of newlines encountered. The two
* values will differ if #gets is called with a separator other than newline.
*
* 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.lineno #=> 0