Sha256: da9b0bbe75e35794aa2210fa1a86c56144a373590fec659265316397767d2acb

Contents?: true

Size: 337 Bytes

Versions: 2

Compression:

Stored size: 337 Bytes

Contents

require 'igp'
require 'stringio'

def capture(*streams)
  streams.map!(&:to_s)
  begin
    result = StringIO.new
    streams.each { |stream| eval "$#{stream} = result # $#{stream} = result" }
    yield
  ensure
    streams.each { |stream| eval("$#{stream} = #{stream.upcase} # $#{stream} = #{stream.upcase}") }
  end
  result.string
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
igp-1.1.0 spec/spec_helper.rb
igp-1.0.0 spec/spec_helper.rb