Sha256: f3d786cd9d17e0f970702ff5953fe0af7cc45e02a5dc04b2efb444aec9575416
Contents?: true
Size: 324 Bytes
Versions: 10
Compression:
Stored size: 324 Bytes
Contents
require 'stringio' module Kernel # Captures STDOUT content and returns it as a string # # >> capture_stdout do # >> puts 'Heya' # >> end # => "Heya\n" def capture_stdout # :yields: out = StringIO.new $stdout = out yield return out.string ensure $stdout = STDOUT end end
Version data entries
10 entries across 10 versions & 1 rubygems