зеркало из https://github.com/github/ruby.git
[ruby/irb] Use gem paths to complete "require"
https://github.com/ruby/irb/commit/c870b23455
This commit is contained in:
Родитель
e4eb085329
Коммит
04984415a5
|
@ -38,8 +38,21 @@ module IRB
|
|||
|
||||
BASIC_WORD_BREAK_CHARACTERS = " \t\n`><=;|&{("
|
||||
|
||||
def self.retrieve_gem_and_system_load_path
|
||||
gem_paths = 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
|
||||
(gem_paths + $LOAD_PATH).uniq.sort
|
||||
end
|
||||
|
||||
def self.retrieve_files_to_require_from_load_path
|
||||
@@files_from_load_path ||= $LOAD_PATH.flat_map { |path|
|
||||
@@files_from_load_path ||= retrieve_gem_and_system_load_path.flat_map { |path|
|
||||
begin
|
||||
Dir.glob("**/*.{rb,#{RbConfig::CONFIG['DLEXT']}}", base: path)
|
||||
rescue Errno::ENOENT
|
||||
|
|
Загрузка…
Ссылка в новой задаче