switch(key)
public
Changes the current active irb
session to the given key in the jobs Array.
Raises an IrbAlreadyDead exception if the given key is no longer
alive.
If the given irb session is already
active, an IrbSwitchedToCurrentThread exception is raised.
Show source
def switch(key)
th, irb = search(key)
IRB.fail IrbAlreadyDead unless th.alive?
IRB.fail IrbSwitchedToCurrentThread if th == Thread.current
@current_job = irb
th.run
Thread.stop
@current_job = irb(Thread.current)
end