Module: IRB::ExtendCommandBundle
Relationships & Source Files | |
Defined in: | lib/irb/default_commands.rb, lib/irb/ext/use-loader.rb |
Overview
Installs the default irb extensions command bundle.
Constant Summary
-
NO_OVERRIDE =
See
#install_alias_method
.0
-
OVERRIDE_ALL =
See
#install_alias_method
.0x02
-
OVERRIDE_PRIVATE_ONLY =
See
#install_alias_method
.0x01
Class Method Summary
- .all_commands_info
- .command_names
- .command_override_policies
-
.def_extend_command(cmd_name, cmd_class, _, *aliases)
Drepcated.
- .execute_as_command?(name, public_method:, private_method:) ⇒ Boolean
-
.load_command(command)
Convert a command name to its implementation class if such command exists.
Instance Method Summary
-
#irb_load(*opts, &b)
Loads the given file similarly to
Kernel.load
, see IrbLoader#irb_load -
#irb_require(*opts, &b)
Loads the given file similarly to
Kernel.require
Class Method Details
.all_commands_info
[ GitHub ]# File 'lib/irb/default_commands.rb', line 186
def self.all_commands_info user_aliases = IRB.CurrentContext.command_aliases.each_with_object({}) do |(alias_name, target), result| result[target] ||= [] result[target] << alias_name end Command.commands.map do |command_name, (command_class, aliases)| aliases = aliases.map { |a| a.first } if additional_aliases = user_aliases[command_name] aliases += additional_aliases end display_name = aliases.shift || command_name { display_name: display_name, description: command_class.description, category: command_class.category } end end
.command_names
[ GitHub ]# File 'lib/irb/default_commands.rb', line 225
def self.command_names command_override_policies.keys.map(&:to_s) end
.command_override_policies
[ GitHub ]# File 'lib/irb/default_commands.rb', line 208
def self.command_override_policies @@command_override_policies ||= Command.commands.flat_map do |cmd_name, (cmd_class, aliases)| [[cmd_name, OVERRIDE_ALL]] + aliases end.to_h end
.def_extend_command(cmd_name, cmd_class, _, *aliases)
Drepcated. Use Command.regiser
instead.
# File 'lib/irb/default_commands.rb', line 244
def self.def_extend_command(cmd_name, cmd_class, _, *aliases) Command._register_with_aliases(cmd_name, cmd_class, *aliases) @@command_override_policies = nil end
.execute_as_command?(name, public_method:, private_method:) ⇒ Boolean
# File 'lib/irb/default_commands.rb', line 214
def self.execute_as_command?(name, public_method:, private_method:) case command_override_policies[name] when OVERRIDE_ALL true when OVERRIDE_PRIVATE_ONLY !public_method when NO_OVERRIDE !public_method && !private_method end end
.load_command(command)
Convert a command name to its implementation class if such command exists
Instance Method Details
#irb_load(*opts, &b)
Loads the given file similarly to Kernel.load
, see IrbLoader#irb_load
#irb_require(*opts, &b)
Loads the given file similarly to Kernel.require