aboutsummaryrefslogtreecommitdiffstats
path: root/lib/scanf.rb
diff options
context:
space:
mode:
authordblack <dblack@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-06 01:49:40 +0000
committerdblack <dblack@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-06 01:49:40 +0000
commitac9845a16c237e850bb5fa53cf0e9430fe2a302e (patch)
tree81f8fa7cd69de06ceb8b5283804542694b9fda1b /lib/scanf.rb
parent1c77623b1be453327c3d85f0f6b63fd2d7efb96e (diff)
downloadruby-ac9845a16c237e850bb5fa53cf0e9430fe2a302e.tar.gz
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
Diffstat (limited to 'lib/scanf.rb')
-rw-r--r--lib/scanf.rb3
1 files changed, 2 insertions, 1 deletions
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