Class: IRB::TypeCompletor
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
BaseCompletor
|
|
|
Instance Chain:
self,
BaseCompletor
|
|
| Inherits: |
IRB::BaseCompletor
|
| Defined in: | lib/irb/completion.rb |
Constant Summary
BaseCompletor - Inherited
Class Method Summary
- .new(context) ⇒ TypeCompletor constructor
Instance Method Summary
- #completion_candidates(preposing, target, _postposing, bind:)
- #doc_namespace(preposing, matched, _postposing, bind:)
- #inspect
BaseCompletor - Inherited
Constructor Details
.new(context) ⇒ TypeCompletor
# File 'lib/irb/completion.rb', line 87
def initialize(context) @context = context end
Instance Method Details
#completion_candidates(preposing, target, _postposing, bind:)
[ GitHub ]# File 'lib/irb/completion.rb', line 95
def completion_candidates(preposing, target, _postposing, bind:) # When completing the argument of `help` command, only commands should be candidates return command_candidates(target) if preposing.match?(HELP_COMMAND_PREPOSING) commands = if preposing.empty? command_candidates(target) # It doesn't make sense to propose commands with other preposing else [] end result = ReplTypeCompletor.analyze(preposing + target, binding: bind, filename: @context.irb_path) return commands unless result encoded_candidates = result.completion_candidates.filter_map do |i| encoded = i.encode(Encoding.default_external) target + encoded rescue Encoding::UndefinedConversionError # If the string cannot be converted, we just ignore it nil end commands | encoded_candidates end
#doc_namespace(preposing, matched, _postposing, bind:)
[ GitHub ]# File 'lib/irb/completion.rb', line 120
def doc_namespace(preposing, matched, _postposing, bind:) result = ReplTypeCompletor.analyze(preposing + matched, binding: bind, filename: @context.irb_path) result&.doc_namespace('') end
#inspect
[ GitHub ]# File 'lib/irb/completion.rb', line 91
def inspect ReplTypeCompletor.info end