load_file(path, priv = nil)
public
Loads the given file in the current session’s context and evaluates it.
See Irb#suspend_input_method for more information.
Show source
def load_file(path, priv = nil)
irb.suspend_name(path, File.basename(path)) do
if priv
ws = WorkSpace.new(Module.new)
else
ws = WorkSpace.new
end
irb.suspend_workspace(ws) do
irb.suspend_input_method(FileInputMethod.new(path)) 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