Skip to content

Commit 29901e4

Browse files
authored
Add disable_irb command to disable debug of binding.irb (#898)
* Add disable_irb command to disable debug of binding.irb * disable_irb doesn't override Kernel.exit Kernel.exit call is removed because disable_irb does not override Kernel.exit and workaround to https://bugs.ruby-lang.org/issues/18234 is not needed.
1 parent 1a1fbba commit 29901e4

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lib/irb/command.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ def irb_context
196196
:irb_history, :History, "command/history",
197197
[:history, NO_OVERRIDE],
198198
[:hist, NO_OVERRIDE],
199-
]
199+
],
200+
201+
[
202+
:irb_disable_irb, :DisableIrb, "command/disable_irb",
203+
[:disable_irb, NO_OVERRIDE],
204+
],
200205
]
201206

202207

lib/irb/command/disable_irb.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
module IRB
4+
# :stopdoc:
5+
6+
module Command
7+
class DisableIrb < Base
8+
category "IRB"
9+
description "Disable binding.irb."
10+
11+
def execute(*)
12+
::Binding.define_method(:irb) {}
13+
IRB.irb_exit
14+
end
15+
end
16+
end
17+
18+
# :startdoc:
19+
end

0 commit comments

Comments
 (0)