From: Tanaka Akira Date: 2013-03-29T14:26:22+09:00 Subject: Re: Confusion with ARGF#readpartial 2013/3/27 Pritam Dey : > Could anyone help me to understand how ARGF#readpartial is coded for > each of the above ** marked lines? It seems the document is just copied from IO#readpartial and doesn't describe ARGF specific behavior. Since ARGF is a concatenation of multiple files, read system call notify EOF for each file. ARGF#readpartial returns empty string for EOF on the files except last one. ARGF#readpartial raises EOFError for EOF on the last file. % echo foo > foo % ruby -e 'loop { p ARGF.readpartial(4096) }' foo foo foo "foo\n" "" "foo\n" "" "foo\n" -e:1:in `readpartial': end of file reached (EOFError) from -e:1:in `block in
' from -e:1:in `loop' from -e:1:in `
' -- Tanaka Akira