class IRB::FileInputMethod
Use a File for IO with irb, see InputMethod
def close
def close @io.close end
def encoding
def encoding @external_encoding end
def eof?
there is no more data to read.
Whether the end of this input method has been reached, returns +true+ if
def eof? @io.closed? || @io.eof? end
def gets
Reads the next line from this input method.
def gets print @prompt @io.gets end
def initialize(file)
def initialize(file) @io = file.is_a?(IO) ? file : File.open(file) @external_encoding = @io.external_encoding end
def inspect
def inspect 'FileInputMethod' end
def open(file, &block)
def open(file, &block) begin io = new(file) block.call(io) ensure io&.close end end