Module: IRB::ContextExtender (Ruby 2.3.4)

IRB::ContextExtender

Extends methods for the Context module

Public Class Methods

def_extend_command(cmd_name, load_file, *aliases)

Evaluate the given command from the given load_file on the Context module.

Will also define any given aliases for the method.

 
               # File irb/extend-command.rb, line 239
def self.def_extend_command(cmd_name, load_file, *aliases)
  line = __LINE__; Context.module_eval %Q[
    def #{cmd_name}(*opts, &b)
      Context.module_eval {remove_method(:#{cmd_name})}
      require "#{load_file}"
      send :#{cmd_name}, *opts, &b
    end
    for ali in aliases
      alias_method ali, cmd_name
    end
  ], __FILE__, line
end
            
install_extend_commands()

Installs the default context extensions as irb commands:

IRB::Context#eval_history=

irb/ext/history.rb

IRB::Context#use_tracer=

irb/ext/tracer.rb

IRB::Context#math_mode=

irb/ext/math-mode.rb

IRB::Context#use_loader=

irb/ext/use-loader.rb

IRB::Context#save_history=

irb/ext/save-history.rb

 
               # File irb/extend-command.rb, line 229
def self.install_extend_commands
  for args in @EXTEND_COMMANDS
    def_extend_command(*args)
  end
end