From 37dde6e2f82304848636015c0ce032cbdb5cd2a9 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Fri, 23 Feb 2024 18:02:14 +0800 Subject: [ruby/irb] Unroll extension method generation (https://github.com/ruby/irb/pull/882) * Unroll extension method generation Given we only have 2 remaining extension setter methods, both of which only take 1 argument and don't have any alias, the current method generation logic is overly complicated. This commit simplifies the method generation logic by simply defining the methods directly in the `IRB::Context` class. * Fix use_loader extension https://github.com/ruby/irb/commit/67eba5401b --- lib/irb/context.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/irb/context.rb') diff --git a/lib/irb/context.rb b/lib/irb/context.rb index e50958978f..8eef3dff46 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -166,6 +166,18 @@ module IRB IRB.conf[:USE_TRACER] = val end + def eval_history=(val) + self.class.remove_method(__method__) + require_relative "ext/eval_history" + __send__(__method__, val) + end + + def use_loader=(val) + self.class.remove_method(__method__) + require_relative "ext/use-loader" + __send__(__method__, val) + end + private def build_completor completor_type = IRB.conf[:COMPLETOR] case completor_type -- cgit v1.2.3