Sha256: 8869ec2de84b9f8d46683c6fba9acb16c2ee8f5adc45edd5a8f4b2bfb47c092e

Contents?: true

Size: 286 Bytes

Versions: 50

Compression:

Stored size: 286 Bytes

Contents

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

50 entries across 50 versions & 3 rubygems

Version Path
bundler-1.7.15 spec/support/streams.rb
bundler-1.7.14 spec/support/streams.rb
bundler-1.7.13 spec/support/streams.rb
bundler-1.7.12 spec/support/streams.rb
bundler-1.7.11 spec/support/streams.rb
bundler-1.7.10 spec/support/streams.rb
bundler-1.7.9 spec/support/streams.rb
bundler-1.7.8 spec/support/streams.rb
bundler-1.7.7 spec/support/streams.rb
bundler-1.7.6 spec/support/streams.rb
bundler-1.6.9 spec/support/streams.rb
bundler-1.7.5 spec/support/streams.rb
bundler-1.6.8 spec/support/streams.rb
bundler-1.7.4 spec/support/streams.rb
bundler-1.6.7 spec/support/streams.rb
bundler-1.7.3 spec/support/streams.rb
bundler-1.6.6 spec/support/streams.rb
bundler-1.7.2 spec/support/streams.rb
bundler-1.7.1 spec/support/streams.rb
bundler-1.7.1.pre.3 spec/support/streams.rb