summaryrefslogtreecommitdiffstats
path: root/lib
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
commit40e7a60039a00cba0001ae46b862e50c3a2b8542 (patch)
tree81f8fa7cd69de06ceb8b5283804542694b9fda1b /lib
parent4f5d853bb769fa51478d33a6697188bfba92c457 (diff)
downloadruby-40e7a60039a00cba0001ae46b862e50c3a2b8542.tar.gz
ruby-40e7a60039a00cba0001ae46b862e50c3a2b8542.tar.xz
ruby-40e7a60039a00cba0001ae46b862e50c3a2b8542.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/scanf.rb3
1 files changed, 2 insertions, 1 deletions
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