Use a File for IO with irb, see InputMethod
encoding() Instance Public methods The external encoding for standard input
new(file) Class Public methods Creates a new input method object
eof?() Instance Public methods Whether the end of this input method has been
gets() Instance Public methods Reads the next line from this input method.