From: Brian Candler Date: 2010-06-29T17:03:10+09:00 Subject: Re: Reading String Data as a File Ryan Davis wrote: > ri StringIO That will work if the code in question will accept an open File/IO object as an argument. If it takes only a pathname argument, then you're stuck with writing the data to a file (ri Tempfile may help). If you have control of the target code, then refactor it. e.g. class Foo # original entry point def read_file(pathname) File.open(pathname,"rb") { |f| read_io(f) } end # entry point for already-open object, e.g. STDIN, a StringIO etc. def read_io(io) io.each_line { ... } end end -- Posted via http://www.ruby-forum.com/.