Sha256: 84b0e7fcd31524984601a0c5213d184e0dba42f663c21b44337859dc421f047d
Contents?: true
Size: 391 Bytes
Versions: 12
Compression:
Stored size: 391 Bytes
Contents
module StreamHelpers def capture(stream) stream = stream.to_s captured_stream = Tempfile.new(stream) stream_io = eval("$#{stream}") origin_stream = stream_io.dup stream_io.reopen(captured_stream) yield stream_io.rewind return captured_stream.read ensure captured_stream.close captured_stream.unlink stream_io.reopen(origin_stream) end end
Version data entries
12 entries across 12 versions & 1 rubygems