From: Chad Perrin Date: 2008-11-16T04:08:58+09:00 Subject: Re: IO#lineno= doesn't work the way I expected --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 16, 2008 at 02:27:45AM +0900, Tim Hunter wrote: >=20 > The way I read the ri doc for lineno=3D, it appears that all it does is= =20 > determine the value that lineno returns the next time you call it. That= =20 > is, it doesn't move the read position in the file. I think you're confusing lineno=3D with lineno (which are two separate methods). IO#lineno does this: ios.lineno =3D> 0 IO#lineno=3D does this: ios.lineno =3D 3 =3D> 3 The class is specced here, with the screen scrolled to where IO#lineno and IO#lineno=3D are listed: http://ruby-doc.org/core/classes/IO.html#M002289 >=20 > I think what you're looking for is IO#seek, but notice that it seek=20 > doesn't operate on lines, only on byte offsets. That would make IO#seek not what I want, unfortunately. Line lengths are not known in advance. --=20 Chad Perrin [ content licensed PDL: http://pdl.apotheon.org ] Quoth Larry Wall: "You can never entirely stop being what you once were. That's why it's important to be the right person today, and not put it off till tomorrow." --gBBFr7Ir9EOA20Yy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkkfHxYACgkQ9mn/Pj01uKVlkQCcDvlxMMfNPf6yeMDLm0xZ+k5/ 0UIAn2/1ErnMoKBVHElCKiYT3HP9U54q =HMTW -----END PGP SIGNATURE----- --gBBFr7Ir9EOA20Yy--