class StIO

In some cases, there is the need to redirect standard output to a string. In general class StIO will do it without any problem. However, when integrating with some libraries, for instace, Renjin, Renjin standard output and Ruby standard output are different, so we need to redirect both standard outputs to the same string. The integrating library will have to implement methods set_std_out, set_std_err, set_default_std_out and set_default_std_err.

Attributes

alternate_err[R]
alternate_out[R]

Public Instance Methods

set_default_std_out() click to toggle source
# File lib/code_writer/rbmarkdown.rb, line 46
def set_default_std_out
  $stdout = STDOUT
end
set_std_err(buffer) click to toggle source
# File lib/code_writer/rbmarkdown.rb, line 41
def set_std_err(buffer)
  $stderr = StringIO.new(buffer)
  @alternate_err = buffer
end
set_std_out(buffer) click to toggle source
# File lib/code_writer/rbmarkdown.rb, line 36
def set_std_out(buffer)
  $stdout = StringIO.new(buffer)
  @alternate_out = buffer
end