Sha256: 7bb51a658c04de74b6fd26ecd0cf63e51a04c4a915ed3919ccba7c58cf72d913

Contents?: true

Size: 217 Bytes

Versions: 15

Compression:

Stored size: 217 Bytes

Contents

# Captures stdout I/O.
#
# @example
#     capture_stdout { do_something }
#
def capture_stdout
  begin
    $stdout = StringIO.new
    yield
    result = $stdout.string
  ensure
    $stdout = STDOUT
  end
  result
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
uuids-5.0.0 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.8 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.7 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.6 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.5 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.4 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.3 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.2 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.1 spec/support/development/helpers/capture_stdout.rb
uuids-4.1.0 spec/support/development/helpers/capture_stdout.rb
uuids-4.0.1 spec/support/development/helpers/capture_stdout.rb
uuids-4.0.0 spec/support/development/helpers/capture_stdout.rb
uuids-3.0.0 spec/support/development/helpers/capture_stdout.rb
uuids-2.0.0 spec/support/development/helpers/capture_stdout.rb
uuids-1.4.2 spec/support/development/helpers/capture_stdout.rb