Top Level Namespace
Defined Under Namespace
Classes: Capture
Instance Method Summary collapse
-
#Capture(io = nil, &block) ⇒ Object
Captures STDOUT or STDERR and returns the output.
Instance Method Details
#Capture(io = nil, &block) ⇒ Object
Captures STDOUT or STDERR and returns the output.
>> Capture { puts 'hello' }
=> 'hello'
>> Capture(:stdout){ puts 'hello stdout' }
=> 'hello stdout'
>> Capture(:stderr){ warn 'hello stderr' }
=> 'hello stderr'
86 87 88 |
# File 'lib/io-capture.rb', line 86 def Capture io = nil, &block Capture.do io, &block end |