From 3e788f742135b0cf3f79034dc7af3fb62831f1e1 Mon Sep 17 00:00:00 2001 From: Masataka Pocke Kuwabara Date: Thu, 13 Jun 2019 16:09:02 +0900 Subject: [PATCH] Suppress warnings --- lib/irb/ext/history.rb | 3 ++- lib/irb/ext/save-history.rb | 2 +- lib/irb/ext/use-loader.rb | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb index 62363b13f..43c3e4dbf 100644 --- a/lib/irb/ext/history.rb +++ b/lib/irb/ext/history.rb @@ -22,7 +22,7 @@ class Context def set_last_value(value) _set_last_value(value) - if @eval_history + if defined?(@eval_history) && @eval_history @eval_history_values.push @line_no, @last_value @workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}" end @@ -30,6 +30,7 @@ def set_last_value(value) @last_value end + remove_method :eval_history= if method_defined?(:eval_history=) # The command result history limit. attr_reader :eval_history # Sets command result history limit. diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb index 8ee5d269e..9aeb5dee0 100644 --- a/lib/irb/ext/save-history.rb +++ b/lib/irb/ext/save-history.rb @@ -27,7 +27,7 @@ def save_history IRB.conf[:SAVE_HISTORY] end - remove_method :save_history= if respond_to?(:save_history=) + remove_method :save_history= if method_defined?(:save_history=) # Sets IRB.conf[:SAVE_HISTORY] to the given +val+ and calls # #init_save_history with this context. # diff --git a/lib/irb/ext/use-loader.rb b/lib/irb/ext/use-loader.rb index cc7170667..cb10e8a25 100644 --- a/lib/irb/ext/use-loader.rb +++ b/lib/irb/ext/use-loader.rb @@ -20,10 +20,12 @@ class Object module IRB module ExtendCommandBundle + remove_method :irb_load if method_defined?(:irb_load) # Loads the given file similarly to Kernel#load, see IrbLoader#irb_load def irb_load(*opts, &b) ExtendCommand::Load.execute(irb_context, *opts, &b) end + remove_method :irb_require if method_defined?(:irb_require) # Loads the given file similarly to Kernel#require def irb_require(*opts, &b) ExtendCommand::Require.execute(irb_context, *opts, &b) @@ -44,6 +46,7 @@ def use_loader alias use_loader? use_loader + remove_method :use_loader= if method_defined?(:use_loader=) # Sets IRB.conf[:USE_LOADER] # # See #use_loader for more information.