Sha256: 3f4c9f0c3d6b4b39d45d3531ddab28cc05cbaf289741b1e132534ef79d9f78e1

Contents?: true

Size: 288 Bytes

Versions: 13

Compression:

Stored size: 288 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

13 entries across 13 versions & 1 rubygems

Version Path
upstart-exporter-2.1.5 spec/support/streams.rb
upstart-exporter-2.1.4 spec/support/streams.rb
upstart-exporter-2.1.3 spec/support/streams.rb
upstart-exporter-2.1.2 spec/support/streams.rb
upstart-exporter-2.1.1 spec/support/streams.rb
upstart-exporter-2.0.1 spec/support/streams.rb
upstart-exporter-1.0.1 spec/support/streams.rb
upstart-exporter-1.0.0 spec/support/streams.rb
upstart-exporter-0.1.4 spec/support/streams.rb
upstart-exporter-0.1.3 spec/support/streams.rb
upstart-exporter-0.1.2 spec/support/streams.rb
upstart-exporter-0.1.1 spec/support/streams.rb
upstart-exporter-0.1.0 spec/support/streams.rb