summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/irb/command.rb7
-rw-r--r--lib/irb/command/disable_irb.rb19
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/irb/command.rb b/lib/irb/command.rb
index 4dc2994ba9..ef93049237 100644
--- a/lib/irb/command.rb
+++ b/lib/irb/command.rb
@@ -196,7 +196,12 @@ module IRB # :nodoc:
:irb_history, :History, "command/history",
[:history, NO_OVERRIDE],
[:hist, NO_OVERRIDE],
- ]
+ ],
+
+ [
+ :irb_disable_irb, :DisableIrb, "command/disable_irb",
+ [:disable_irb, NO_OVERRIDE],
+ ],
]
diff --git a/lib/irb/command/disable_irb.rb b/lib/irb/command/disable_irb.rb
new file mode 100644
index 0000000000..0b00d0302b
--- /dev/null
+++ b/lib/irb/command/disable_irb.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module IRB
+ # :stopdoc:
+
+ module Command
+ class DisableIrb < Base
+ category "IRB"
+ description "Disable binding.irb."
+
+ def execute(*)
+ ::Binding.define_method(:irb) {}
+ IRB.irb_exit
+ end
+ end
+ end
+
+ # :startdoc:
+end