提交 991cd59a 编写于 作者: W wycats

If a file is in the load path, require it without its full path (in more places)

上级 8bf79739
......@@ -388,8 +388,13 @@ def loadable_constants_for_path(path, bases = autoload_paths)
end
# Search for a file in autoload_paths matching the provided suffix.
def search_for_file(path_suffix)
path_suffix = path_suffix.sub(/(\.rb)?$/, ".rb")
def search_for_file(file)
path_suffix = file.sub(/(\.rb)?$/, ".rb")
$:.each do |root|
path = File.join(root, path_suffix)
return file if File.file?(path)
end
autoload_paths.each do |root|
path = File.join(root, path_suffix)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册