diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb index 62363b13f4..43c3e4dbf3 100644 --- a/lib/irb/ext/history.rb +++ b/lib/irb/ext/history.rb @@ -22,7 +22,7 @@ module IRB # :nodoc: 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 @@ module IRB # :nodoc: @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 8ee5d269e6..9aeb5dee0c 100644 --- a/lib/irb/ext/save-history.rb +++ b/lib/irb/ext/save-history.rb @@ -27,7 +27,7 @@ module IRB 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 cc71706671..cb10e8a254 100644 --- a/lib/irb/ext/use-loader.rb +++ b/lib/irb/ext/use-loader.rb @@ -20,10 +20,12 @@ end 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 @@ module IRB 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.