Class: IRB::TypeCompletor
- Inherits:
-
BaseCompletor
- Object
- BaseCompletor
- IRB::TypeCompletor
- Defined in:
- lib/irb/completion.rb
Overview
:nodoc:
Constant Summary
Constants inherited from BaseCompletor
BaseCompletor::GEM_PATHS, BaseCompletor::HELP_COMMAND_PREPOSING, BaseCompletor::ReservedWords
Instance Method Summary collapse
- #completion_candidates(preposing, target, _postposing, bind:) ⇒ Object
- #doc_namespace(preposing, matched, _postposing, bind:) ⇒ Object
-
#initialize(context) ⇒ TypeCompletor
constructor
A new instance of TypeCompletor.
- #inspect ⇒ Object
Methods inherited from BaseCompletor
#command_candidates, #retrieve_files_to_require_from_load_path, #retrieve_files_to_require_relative_from_current_dir, #retrieve_gem_and_system_load_path
Constructor Details
#initialize(context) ⇒ TypeCompletor
Returns a new instance of TypeCompletor.
107 108 109 |
# File 'lib/irb/completion.rb', line 107 def initialize(context) @context = context end |
Instance Method Details
#completion_candidates(preposing, target, _postposing, bind:) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/irb/completion.rb', line 115 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 commands | result.completion_candidates.map { target + _1 } end |
#doc_namespace(preposing, matched, _postposing, bind:) ⇒ Object
133 134 135 136 |
# File 'lib/irb/completion.rb', line 133 def doc_namespace(preposing, matched, _postposing, bind:) result = ReplTypeCompletor.analyze(preposing + matched, binding: bind, filename: @context.irb_path) result&.doc_namespace('') end |
#inspect ⇒ Object
111 112 113 |
# File 'lib/irb/completion.rb', line 111 def inspect ReplTypeCompletor.info end |