From 4bdfc9070cf626db4553a6cd15dbae19604180cf Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sat, 6 Jan 2024 17:15:12 +0000 Subject: [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 --- lib/irb.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/irb.rb') diff --git a/lib/irb.rb b/lib/irb.rb index daa0d64f28..4de8dda071 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -886,8 +886,8 @@ module IRB end # Quits irb - def IRB.irb_exit(irb, ret) - throw :IRB_EXIT, ret + def IRB.irb_exit(*) + throw :IRB_EXIT end # Aborts then interrupts irb. -- cgit v1.2.3