Sha256: 75d4fc9d1532dfbfc4c9db2bf98bb12b35350e1e0c32fb96542833f27ac695c3
Contents?: true
Size: 318 Bytes
Versions: 16
Compression:
Stored size: 318 Bytes
Contents
require 'stringio' # # Capture STDOUT and STDERR # def capture(*streams) streams.map! { |stream| stream.to_s } begin result = StringIO.new streams.each { |stream| eval "$#{stream} = result" } yield ensure streams.each { |stream| eval("$#{stream} = #{stream.upcase}") } end result.string end
Version data entries
16 entries across 16 versions & 1 rubygems