Method: Erudite::Example.without_stdio
- Defined in:
- lib/erudite/example.rb
.without_stdio ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/erudite/example.rb', line 32 def self.without_stdio stdin, stdout, stderr, argv = $stdin, $stdout, $stderr, $ARGV.dup io = $stdin = $stdout = $stderr = StringIO.new $ARGV.clear [yield, io] ensure $stdin, $stdout, $stderr = stdin, stdout, stderr $ARGV.replace(argv) end |