mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 20:44:20 +00:00
as names (https://github.com/ruby/irb/pull/932) This will save users some heads scratching when they try to register a command with a string name and found that it doesn't work. I also rewrote converted custom command tests into integration tests to make test setup/cleanup easier. https://github.com/ruby/irb/commit/a91a212dbe
24 lines
484 B
Ruby
24 lines
484 B
Ruby
# frozen_string_literal: true
|
|
#
|
|
# irb/command.rb - irb command
|
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
|
#
|
|
|
|
require_relative "command/base"
|
|
|
|
module IRB # :nodoc:
|
|
module Command
|
|
@commands = {}
|
|
|
|
class << self
|
|
attr_reader :commands
|
|
|
|
# Registers a command with the given name.
|
|
# Aliasing is intentionally not supported at the moment.
|
|
def register(name, command_class)
|
|
@commands[name.to_sym] = [command_class, []]
|
|
end
|
|
end
|
|
end
|
|
end
|