summaryrefslogtreecommitdiff
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
authorStan Lo <[email protected]>2024-01-06 17:15:12 +0000
committergit <[email protected]>2024-01-06 17:15:16 +0000
commit4bdfc9070cf626db4553a6cd15dbae19604180cf (patch)
tree824e481e6292adc93bc67f39ee5bf2d124825a50 /lib/irb/context.rb
parentd96fe5e4f8dd09bdbcb730b90382ab35e0be03d1 (diff)
[ruby/irb] Refactor exit command
(https://github.com/ruby/irb/pull/835) * Remove unnecessary code from the exit command's implementation 1. The parameters of `IRB.irb_exit` were never used. But there are some libraries seem to call it with arguments + it's declared on the top-level IRB constant. So I changed the params to anonymous splat instead of removing them. 2. `Context#exit` was completely unnecessary as `IRB.irb_exit` doesn't use the `@irb` instance it passes. And since it's (or should be treated as) a private method, I simply removed it. 3. The `exit` command doesn't use the status argument it receives at all. But to avoid raising errors on usages like `exit 1`, I changed the argument to anonymous splat instead removing it. * Make exit an actual command * Update readme https://github.com/ruby/irb/commit/452b543a65
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r--lib/irb/context.rb8
1 files changed, 0 insertions, 8 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index c3690fcac7..10dab86179 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -573,14 +573,6 @@ module IRB
@inspect_method.inspect_value(@last_value)
end
- alias __exit__ exit
- # Exits the current session, see IRB.irb_exit
- def exit(ret = 0)
- IRB.irb_exit(@irb, ret)
- rescue UncaughtThrowError
- super
- end
-
NOPRINTING_IVARS = ["@last_value"] # :nodoc:
NO_INSPECTING_IVARS = ["@irb", "@io"] # :nodoc:
IDNAME_IVARS = ["@prompt_mode"] # :nodoc: