method

capture

v3.1.0 - Show latest stable - Class: Kernel
capture(stream)
public

Captures the given stream and returns it:

stream = capture(:stdout) { puts "Cool" }
stream # => "Cool\n"