123456789_123456789_123456789_123456789_123456789_

Class: IRB::TypeCompletor

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: IRB::BaseCompletor
Defined in: lib/irb/completion.rb

Constant Summary

BaseCompletor - Inherited

GEM_PATHS, HELP_COMMAND_PREPOSING, ReservedWords

Class Method Summary

Instance Method Summary

Constructor Details

.new(context) ⇒ TypeCompletor

[ GitHub ]

  
# File 'lib/irb/completion.rb', line 107

def initialize(context)
  @context = context
end

Instance Method Details

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

[ GitHub ]

  
# 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:)

[ GitHub ]

  
# 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

[ GitHub ]

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

def inspect
  ReplTypeCompletor.info
end