puts "hi"
puts "bye"
I want to store the STDOUT of the code so far (in this case hi \nbye into a variable say 'result' and print it )
puts result
The reason I am doing this is I have integrate an R code into my Ruby code, output of which is given to the STDOUT as the R code runs , but the ouput cannot be accessed inside the code to do some evaluations. Sorry if this is confusing. So the "puts result" line should give me hi and bye.
rinruby
? I also tried to catch rinruby (R) output, but up to now without success. – Vulcanitestderr
, this one tostdout
. You could merge them, but you'd want a search for "capture stdout" to find an answer as well as "capture stderr". – Brownedoff