Class: IRB::TypeCompletor

Inherits:
BaseCompletor show all
Defined in:
lib/irb/completion.rb

Overview

:nodoc:

Constant Summary

Constants inherited from BaseCompletor

BaseCompletor::GEM_PATHS, BaseCompletor::ReservedWords

Instance Method Summary collapse

Methods inherited from BaseCompletor

#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.



97
98
99
# File 'lib/irb/completion.rb', line 97

def initialize(context)
  @context = context
end

Instance Method Details

#completion_candidates(preposing, target, _postposing, bind:) ⇒ Object



105
106
107
108
109
# File 'lib/irb/completion.rb', line 105

def completion_candidates(preposing, target, _postposing, bind:)
  result = ReplTypeCompletor.analyze(preposing + target, binding: bind, filename: @context.irb_path)
  return [] unless result
  result.completion_candidates.map { target + _1 }
end

#doc_namespace(preposing, matched, _postposing, bind:) ⇒ Object



111
112
113
114
# File 'lib/irb/completion.rb', line 111

def doc_namespace(preposing, matched, _postposing, bind:)
  result = ReplTypeCompletor.analyze(preposing + matched, binding: bind, filename: @context.irb_path)
  result&.doc_namespace('')
end

#inspectObject



101
102
103
# File 'lib/irb/completion.rb', line 101

def inspect
  ReplTypeCompletor.info
end