As seen in Python, what is the sys.stdout.write() equivalent in Ruby?
As seen in Python, what is the sys.stdout.write() equivalent in Ruby?
Here is a one liner for both writing and reading to/from stdin and stdout.
$ ruby -e '$stdout.write "hi\n" '
hi
$ echo "somestring" | ruby -e 'p $stdin.read'
"somestring\n"
$ echo "somestring" | ruby -e 'puts $stdin.read'
somestring