class IRB::Context

def change_workspace(*_main)

See IRB::WorkSpace.new for more information.

object, IRB.conf[:MAIN_CONTEXT] when irb was initialized.
#home_workspace which is inherited from +TOPLEVEL_BINDING+ or the main
If the optional argument is omitted, the workspace will be

Changes the current workspace to given object or binding.
def change_workspace(*_main)
  if _main.empty?
    @workspace = home_workspace
    return main
  end
  @workspace = WorkSpace.new(_main[0])
  if !(class<<main;ancestors;end).include?(ExtendCommandBundle)
    main.extend ExtendCommandBundle
  end
end