Class: IO

Inherits:
Object show all
Defined in:
lib/el4r/el4r-sub.rb

Overview

redirect

Class Method Summary collapse

Class Method Details

.redirect(stdout) ⇒ Object

Redirect stdout to STDOUT and executes the block.



519
520
521
522
523
524
525
526
527
528
# File 'lib/el4r/el4r-sub.rb', line 519

def redirect(stdout)
  begin
    stdout_sv = STDOUT.dup
    STDOUT.reopen(stdout)
    yield
  ensure
    STDOUT.flush
    STDOUT.reopen(stdout_sv)
  end
end