$LOAD_PATH.resolve_feature_path

Moved from RubyVM.  [Feature #15903]
This commit is contained in:
Nobuyoshi Nakada 2019-07-11 14:05:34 +09:00
Родитель d34303ad10
Коммит d77b84ca82
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4BC7D6DF58D8DF60
3 изменённых файлов: 4 добавлений и 7 удалений

1
load.c
Просмотреть файл

@ -1238,6 +1238,7 @@ Init_load(void)
vm->expanded_load_path = rb_ary_tmp_new(0);
vm->load_path_snapshot = rb_ary_tmp_new(0);
vm->load_path_check_cache = 0;
rb_define_singleton_method(vm->load_path, "resolve_feature_path", rb_resolve_feature_path, 1);
rb_define_virtual_variable("$\"", get_loaded_features, 0);
rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0);

Просмотреть файл

@ -898,7 +898,7 @@ class TestRequire < Test::Unit::TestCase
}
end
if defined?(RubyVM.resolve_feature_path)
if defined?($LOAD_PATH.resolve_feature_path)
def test_resolve_feature_path
paths, loaded = $:.dup, $".dup
Dir.mktmpdir do |tmp|
@ -907,9 +907,9 @@ class TestRequire < Test::Unit::TestCase
path = File.realpath(file.path)
dir, base = File.split(path)
$:.unshift(dir)
assert_equal([:rb, path], RubyVM.resolve_feature_path(base))
assert_equal([:rb, path], $LOAD_PATH.resolve_feature_path(base))
$".push(path)
assert_equal([:rb, path], RubyVM.resolve_feature_path(base))
assert_equal([:rb, path], $LOAD_PATH.resolve_feature_path(base))
end
end
ensure

4
vm.c
Просмотреть файл

@ -2949,8 +2949,6 @@ static VALUE usage_analysis_register_stop(VALUE self);
* #=> [:rb, "/path/to/set.rb"]
*/
VALUE rb_resolve_feature_path(VALUE klass, VALUE fname);
void
Init_VM(void)
{
@ -3255,8 +3253,6 @@ Init_VM(void)
/* vm_backtrace.c */
Init_vm_backtrace();
rb_define_singleton_method(rb_cRubyVM, "resolve_feature_path", rb_resolve_feature_path, 1);
}
void