12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/im/kernel.rb', line 12
def require(path)
filetype, feature_path = $:.resolve_feature_path(path)
if (loader = Im::Registry.loader_for(path)) ||
((loader = Im::Registry.loader_for(feature_path)) && (path = feature_path))
if :rb == filetype
if loaded = !$LOADED_FEATURES.include?(feature_path)
$LOADED_FEATURES << feature_path
begin
load path, loader
rescue => e
$LOADED_FEATURES.delete(feature_path)
raise e
end
loader.on_file_autoloaded(path)
end
loaded
else
loader.on_dir_autoloaded(path)
true
end
else
required = im_original_require(path)
if required
abspath = $LOADED_FEATURES.last
if loader = Im::Registry.loader_for(abspath)
loader.on_file_autoloaded(abspath)
end
end
required
end
end
|