Module: IRB::ContextExtender (Ruby 2.7.5)
Description: Module : IRB::ContextExtender - Ruby 2.7.5

### Home Classes Methods

### In Files

- irb/extend-command.rb

### Methods

- ::def_extend_command
- ::install_extend_commands

### Class/Module Index

Quicksearch

- Binding
- IRB::Abort
- IRB::Canvas
- IRB::Color
- IRB::Color::SymbolState
- IRB::Context
- IRB::ContextExtender
- IRB::ExtendCommandBundle
- IRB::FileInputMethod
- IRB::Frame
- IRB::Frame::FrameOverflow
- IRB::Frame::FrameUnderflow
- IRB::History
- IRB::InputMethod
- IRB::Inspector
- IRB::Irb
- IRB::IrbLoader
- IRB::JobManager
- IRB::LoadAbort
- IRB::MethodExtender
- IRB::Notifier
- IRB::Notifier::AbstractNotifier
- IRB::Notifier::CompositeNotifier
- IRB::Notifier::ErrUndefinedNotifier
- IRB::Notifier::ErrUnrecognizedLevel
- IRB::Notifier::LeveledNotifier
- IRB::Notifier::NoMsgNotifier
- IRB::OutputMethod
- IRB::OutputMethod::NotImplementedError
- IRB::ReadlineInputMethod
- IRB::ReidlineInputMethod
- IRB::RubyModel
- IRB::StdioInputMethod
- IRB::StdioOutputMethod
- IRB::Vec
- IRB::WorkSpace
- Object
- XMP
- XMP::StringInputMethod

No matching classes.

# IRB::ContextExtender

Extends methods for the `Context` module

### Public Class Methods

def_extend_command(cmd_name, load_file, *aliases) click to toggle source

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 266
    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 "#{load_file}"
          send :#{cmd_name}, *opts, &b
        end
        for ali in aliases
          alias_method ali, cmd_name
        end
      ], __FILE__, line
    end

install_extend_commands() click to toggle source

Installs the default context extensions as irb commands:

`Context#eval_history=`

  `irb/ext/history.rb`

`Context#use_tracer=`

  `irb/ext/tracer.rb`

`Context#use_loader=`

  `irb/ext/use-loader.rb`

`Context#save_history=`

  `irb/ext/save-history.rb`

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