summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2023-10-14 23:12:37 +0900
committergit <svn-admin@ruby-lang.org>2023-10-14 14:12:43 +0000
commit4e5c505bad2a2c6c62992a74b503d7213fbc2b93 (patch)
tree28de5385447614017948c3bd05c8887da301c50f /lib
parent96cd73d78f8986db0aaab9368c2ffa6867613a37 (diff)
[ruby/irb] Restore IRB::InputCompletor for compatibility
(https://github.com/ruby/irb/pull/730) https://github.com/ruby/irb/commit/77265efc5f
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/completion.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 795a35bb2d..61bdc33587 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -415,4 +415,20 @@ module IRB
end
end
end
+
+ module InputCompletor
+ class << self
+ private def regexp_completor
+ @regexp_completor ||= RegexpCompletor.new
+ end
+
+ def retrieve_completion_data(input, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding, doc_namespace: false)
+ regexp_completor.retrieve_completion_data(input, bind: bind, doc_namespace: doc_namespace)
+ end
+ end
+ CompletionProc = ->(target, preposing = nil, postposing = nil) {
+ regexp_completor.completion_candidates(preposing, target, postposing, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding)
+ }
+ end
+ deprecate_constant :InputCompletor
end