[ruby/irb] Allow non-identifier aliases like Pry's @ and $

(https://github.com/ruby/irb/pull/426)

* Allow non-identifier aliases

* Move the configuration to IRB.conf

* Avoid abusing method lookup for symbol aliases

* Add more alias tests

* A small optimization

* Assume non-nil Context

* Load IRB.conf earlier

e23db5132e
This commit is contained in:
Takashi Kokubun 2022-11-03 15:09:51 -07:00 committed by git
parent d24ac6d281
commit a13836e70d
5 changed files with 87 additions and 0 deletions

View file

@ -426,6 +426,9 @@ module IRB
def initialize(workspace = nil, input_method = nil)
@context = Context.new(self, workspace, input_method)
@context.main.extend ExtendCommandBundle
@context.command_aliases.each do |alias_name, cmd_name|
@context.main.install_alias_method(alias_name, cmd_name)
end
@signal_status = :IN_IRB
@scanner = RubyLex.new
end