ruby-changes:20417
From: drbrain <ko1@a...>
Date: Sat, 9 Jul 2011 09:21:54 +0900 (JST)
Subject: [ruby-changes:20417] drbrain:r32465 (trunk): * io.c: Note that methods other than IO#gets may increase IO#lineno.
drbrain 2011-07-09 09:21:44 +0900 (Sat, 09 Jul 2011) New Revision: 32465 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32465 Log: * io.c: Note that methods other than IO#gets may increase IO#lineno. [Ruby 1.9 - Bug #4902] Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 32464) +++ ChangeLog (revision 32465) @@ -1,3 +1,8 @@ +Sat Jul 9 09:14:56 2011 Eric Hodel <drbrain@s...> + + * 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@r...> * common.mk (RUN_OPT): disable gems. Index: io.c =================================================================== --- io.c (revision 32464) +++ io.c (revision 32465) @@ -2633,13 +2633,16 @@ * 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 * f.gets #=> "This is line one\n" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/