summaryrefslogtreecommitdiff
path: root/lib/scanf.rb
diff options
context:
space:
mode:
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 c4da747afe..e2f0d04c14 100644
--- a/lib/scanf.rb
+++ b/lib/scanf.rb
@@ -659,7 +659,8 @@ class IO
last_spec = fstr.last_spec
begin
current = scanf(str)
- final.push(yield(current)) unless current.empty?
+ break if current.empty?
+ final.push(yield(current))
end until eof || fstr.last_spec_tried == last_spec
return final
end