diff options
author | Takashi Kokubun <[email protected]> | 2022-11-03 15:09:51 -0700 |
---|---|---|
committer | git <[email protected]> | 2022-11-03 22:09:55 +0000 |
commit | a13836e70d9cc2eb569911030cbd735d68b4042c () | |
tree | 4ebb9e319a6416d51152f80c71083a47aaf84234 /lib/irb/context.rb | |
parent | d24ac6d2811e461562e3bb95525399bb9cf464f8 (diff) |
[ruby/irb] Allow non-identifier aliases like Pry's @ and $
(https://.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 https://.com/ruby/irb/commit/e23db5132e
-rw-r--r-- | lib/irb/context.rb | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -149,6 +149,8 @@ module IRB if @newline_before_multiline_output.nil? @newline_before_multiline_output = true end end # The top-level workspace, see WorkSpace#main @@ -326,6 +328,9 @@ module IRB # See IRB@Command+line+options for more command line options. attr_accessor :back_trace_limit # Alias for #use_multiline alias use_multiline? use_multiline # Alias for #use_singleline @@ -477,6 +482,13 @@ module IRB line = "begin ::Kernel.raise _; rescue _.class\n#{line}\n""end" @workspace.local_variable_set(:_, exception) end set_last_value(@workspace.evaluate(self, line, irb_path, line_no)) end @@ -522,5 +534,11 @@ module IRB def local_variables # :nodoc: workspace.binding.local_variables end end end |