Module: Flux::Util::Output
- Defined in:
- lib/flux/util/output.rb
Instance Method Summary collapse
-
#capture(channel = :stdout) { ... } ⇒ Object
(also: #silence)
Capture standard IO channel.
Instance Method Details
#capture(channel = :stdout) { ... } ⇒ Object Also known as: silence
Capture standard IO channel.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/flux/util/output.rb', line 9 def capture(channel = :stdout) io = StringIO.new old_io = eval("$#{channel}") eval("$#{channel} = io") yield io.string ensure eval("$#{channel} = old_io") end |