module IRB::IrbLoader

def source_file(path)

See Irb#suspend_input_method for more information.

Loads a given file in the current session and displays the source lines
def source_file(path)
  irb = irb_context.irb
  irb.suspend_name(path, File.basename(path)) do
    FileInputMethod.open(path) do |io|
      irb.suspend_input_method(io) do
        |back_io|
        irb.signal_status(:IN_LOAD) do
          if back_io.kind_of?(FileInputMethod)
            irb.eval_input
          else
            begin
              irb.eval_input
            rescue LoadAbort
              print "load abort!!\n"
            end
          end
        end
      end
    end
  end
end