From ac9845a16c237e850bb5fa53cf0e9430fe2a302e Mon Sep 17 00:00:00 2001 From: dblack Date: Sat, 6 Mar 2004 01:49:40 +0000 Subject: [PATCH] Fixed a logic glitch in IO#block_scanf git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/scanf.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/scanf.rb b/lib/scanf.rb index aeff61c115..c4da747afe 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