Pseudo I/O on String object.

Commonly used to simulate `$stdio` or `$stderr`


require 'stringio'

io = StringIO.new
io.puts "Hello World"
io.string #=> "Hello World\n"
Show files where this class is defined (1 file)
Register or log in to add new notes.
October 11, 2010
0 thanks

Useful for mocking out IO methods like #gets and #puts

This class is helpful when testing certain classes of software libraries that are dependent on console input and output, similar to some testing uses of Java’s StringBuffer