summaryrefslogtreecommitdiff
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
authorStan Lo <[email protected]>2024-02-23 18:02:14 +0800
committergit <[email protected]>2024-02-23 10:02:19 +0000
commit37dde6e2f82304848636015c0ce032cbdb5cd2a9 (patch)
tree4a7f6735f84fb60442d64a445bf976f3723df42f /lib/irb/context.rb
parentf403660805bafd86d4ff8c56094af8d48f58a24d (diff)
[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
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r--lib/irb/context.rb12
1 files changed, 12 insertions, 0 deletions
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