Sha256: 476348bd757f69aed4feec9db60f915bad40a05a746fb416e9858aeafc8266a1
Contents?: true
Size: 411 Bytes
Versions: 14
Compression:
Stored size: 411 Bytes
Contents
require "tempfile" 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
14 entries across 14 versions & 3 rubygems