module IRB::ContextExtender

def self.def_extend_command(cmd_name, load_file, *aliases)

Will also define any given +aliases+ for the method.

module.
Evaluate the given +command+ from the given +load_file+ on the Context
def self.def_extend_command(cmd_name, load_file, *aliases)
  line = __LINE__; Context.module_eval %[
    def #{cmd_name}(*opts, &b)
      Context.module_eval {remove_method(:#{cmd_name})}
      require_relative "#{load_file}"
      __send__ :#{cmd_name}, *opts, &b
    end
    for ali in aliases
      alias_method ali, cmd_name
    end
  ], __FILE__, line
end

def self.install_extend_commands

Context#use_loader=:: +irb/ext/use-loader.rb+
Context#use_tracer=:: +irb/ext/tracer.rb+
Context#eval_history=:: +irb/ext/history.rb+

Installs the default context extensions as irb commands:
def self.install_extend_commands
  for args in @EXTEND_COMMANDS
    def_extend_command(*args)
  end
end