Sha256: c35b4b7afdf4a8a9203fcac5e89d856296a6b2dc46f86140601bad3ed05ca0d3

Contents?: true

Size: 299 Bytes

Versions: 2

Compression:

Stored size: 299 Bytes

Contents

require 'igp'
require 'stringio'

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

2 entries across 2 versions & 1 rubygems

Version Path
igp-0.0.3 spec/spec_helper.rb
igp-0.0.2 spec/spec_helper.rb