From 40e7a60039a00cba0001ae46b862e50c3a2b8542 Mon Sep 17 00:00:00 2001 From: dblack Date: Sat, 6 Mar 2004 01:49:40 +0000 Subject: Fixed a logic glitch in IO#block_scanf git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/scanf.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/scanf.rb') diff --git a/lib/scanf.rb b/lib/scanf.rb index aeff61c11..c4da747af 100644 --- a/lib/scanf.rb +++ b/lib/scanf.rb @@ -656,10 +656,11 @@ class IO # Sub-ideal, since another FS gets created in scanf. # But used here to determine the number of specifiers. fstr = Scanf::FormatString.new(str) + last_spec = fstr.last_spec begin current = scanf(str) final.push(yield(current)) unless current.empty? - end until eof || current.size < fstr.spec_count + end until eof || fstr.last_spec_tried == last_spec return final end end -- cgit