Class: IRB::BaseCompletor
Do not use. This class is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | lib/irb/completion.rb |
Constant Summary
-
GEM_PATHS =
# File 'lib/irb/completion.rb', line 44if defined?(Gem::Specification) Gem::Specification.latest_specs(true).map { |s| s.require_paths.map { |p| if File.absolute_path?(p) p else File.join(s.full_gem_path, p) end } }.flatten else [] end.freeze
-
ReservedWords =
Set of reserved words used by Ruby, you should not use these for constants or variables
%w[ __ENCODING__ __LINE__ __FILE__ BEGIN END alias and begin break case class def defined? do else elsif end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield ]
Instance Method Summary
Instance Method Details
#command_completions(preposing, target)
[ GitHub ]# File 'lib/irb/completion.rb', line 89
def command_completions(preposing, target) if preposing.empty? && !target.empty? IRB::Command.command_names.select { _1.start_with?(target) } else [] end end
#completion_candidates(preposing, target, postposing, bind:)
# File 'lib/irb/completion.rb', line 36
def completion_candidates(preposing, target, postposing, bind:) raise NotImplementedError end
#doc_namespace(preposing, matched, postposing, bind:)
# File 'lib/irb/completion.rb', line 40
def doc_namespace(preposing, matched, postposing, bind:) raise NotImplementedError end
#retrieve_files_to_require_from_load_path
[ GitHub ]# File 'lib/irb/completion.rb', line 70
def retrieve_files_to_require_from_load_path @files_from_load_path ||= ( shortest = [] rest = retrieve_gem_and_system_load_path.each_with_object([]) { |path, result| begin names = Dir.glob("**/*.{rb,#{RbConfig::CONFIG['DLEXT']}}", base: path) rescue Errno::ENOENT nil end next if names.empty? names.map! { |n| n.sub(/\.(rb|#{RbConfig::CONFIG['DLEXT']})\z/, '') }.sort! shortest << names.shift result.concat(names) } shortest.sort! | rest ) end
#retrieve_files_to_require_relative_from_current_dir
[ GitHub ]# File 'lib/irb/completion.rb', line 97
def retrieve_files_to_require_relative_from_current_dir @files_from_current_dir ||= Dir.glob("**/*.{rb,#{RbConfig::CONFIG['DLEXT']}}", base: '.').map { |path| path.sub(/\.(rb|#{RbConfig::CONFIG['DLEXT']})\z/, '') } end
#retrieve_gem_and_system_load_path
[ GitHub ]# File 'lib/irb/completion.rb', line 59
def retrieve_gem_and_system_load_path candidates = (GEM_PATHS | $LOAD_PATH) candidates.map do |p| if p.respond_to?(:to_path) p.to_path else String(p) rescue nil end end.compact.sort end