Skip to content

Commit

Permalink
Fixed a logic glitch in IO#block_scanf
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
dblack committed Mar 6, 2004
1 parent 1c77623 commit ac9845a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/scanf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,11 @@ def block_scanf(str)
# 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
Expand Down

0 comments on commit ac9845a

Please sign in to comment.