1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
dblack 2004-03-06 01:49:40 +00:00
parent 1c77623b1b
commit ac9845a16c

View file

@ -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