diff --git a/ChangeLog b/ChangeLog index 6dd7a06b27..0fef82a212 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jul 9 09:14:56 2011 Eric Hodel + + * 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 * common.mk (RUN_OPT): disable gems. diff --git a/io.c b/io.c index 90cc2b3a30..2a161ed424 100644 --- a/io.c +++ b/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 ios. The stream must be + * Returns the current line number in ios. The stream must be * opened for reading. lineno counts the number of times - * 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. See also the - * $. 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 $/ like #each, #lines and #readline will + * also increment lineno. + * + * See also the $. variable. * * f = File.new("testfile") * f.lineno #=> 0