From 745ab168185fc8f3c9d9dbd3a2355738776aee6d Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 24 Nov 2019 22:42:08 +0900 Subject: [PATCH] Disable tracer ext of IRB when tracer doesn't found --- lib/irb/ext/tracer.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb index 200f77e341..a1eeff3851 100644 --- a/lib/irb/ext/tracer.rb +++ b/lib/irb/ext/tracer.rb @@ -9,7 +9,21 @@ # # # -require "tracer" +begin + raise LoadError + require "tracer" +rescue LoadError + $stderr.puts "Tracer extension of IRB is enabled but tracer gem doesn't found." + module IRB + TracerLoadError = true + class Context + def use_tracer=(opt) + # do nothing + end + end + end + return # This is about to disable loading below +end module IRB