method
block_scanf
v1_8_7_330 -
Show latest stable
- Class:
IO
block_scanf(str)private
No documentation available.
# File lib/scanf.rb, line 653
def block_scanf(str)
final = []
# 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)
break if current.empty?
final.push(yield(current))
end until eof || fstr.last_spec_tried == last_spec
return final
end