method

capture

capture(stream)
public

Captures the given stream and returns it:

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