summaryrefslogtreecommitdiff
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r--lib/irb/context.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index a7b8ca2c26..3442fbf4da 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -146,9 +146,21 @@ module IRB
@newline_before_multiline_output = true
end
- @command_aliases = IRB.conf[:COMMAND_ALIASES]
+ @user_aliases = IRB.conf[:COMMAND_ALIASES].dup
+ @command_aliases = @user_aliases.merge(KEYWORD_ALIASES)
end
+ # because all input will eventually be evaluated as Ruby code,
+ # command names that conflict with Ruby keywords need special workaround
+ # we can remove them once we implemented a better command system for IRB
+ KEYWORD_ALIASES = {
+ :break => :irb_break,
+ :catch => :irb_catch,
+ :next => :irb_next,
+ }.freeze
+
+ private_constant :KEYWORD_ALIASES
+
private def build_completor
completor_type = IRB.conf[:COMPLETOR]
case completor_type