Feature #12639 ยป feature_loaded.patch
lib/rubygems/core_ext/kernel_require.rb | ||
---|---|---|
private :gem_original_require
|
||
end
|
||
if defined?(loaded_feature?)
|
||
def gem_loaded_feature?(path)
|
||
loaded_feature?(path)
|
||
end
|
||
else
|
||
def gem_loaded_feature?(path)
|
||
false
|
||
end
|
||
end
|
||
private :gem_loaded_feature?
|
||
##
|
||
# When RubyGems is required, Kernel#require is replaced with our own which
|
||
# is capable of loading gems on demand.
|
||
... | ... | |
# that file has already been loaded is preserved.
|
||
def require path
|
||
RUBYGEMS_ACTIVATION_MONITOR.enter
|
||
path = path.to_path if path.respond_to? :to_path
|
||
return false if gem_loaded_feature?(path)
|
||
RUBYGEMS_ACTIVATION_MONITOR.enter
|
||
spec = Gem.find_unresolved_default_spec(path)
|
||
if spec
|
||
... | ... | |
private :require
|
||
end
|
||
load.c | ||
---|---|---|
return rb_feature_provided(feature, 0);
|
||
}
|
||
VALUE
|
||
rb_f_loaded_feature(VALUE obj, VALUE fname)
|
||
{
|
||
return rb_provided(RSTRING_PTR(rb_str_encode_ospath(fname))) ? Qtrue : Qfalse;
|
||
}
|
||
int
|
||
rb_feature_provided(const char *feature, const char **loading)
|
||
{
|
||
... | ... | |
rb_define_method(rb_cModule, "autoload?", rb_mod_autoload_p, 1);
|
||
rb_define_global_function("autoload", rb_f_autoload, 2);
|
||
rb_define_global_function("autoload?", rb_f_autoload_p, 1);
|
||
rb_define_global_function("loaded_feature?", rb_f_loaded_feature, 1);
|
||
ruby_dln_librefs = rb_ary_tmp_new(0);
|
||
rb_gc_register_mark_object(ruby_dln_librefs);
|