23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/onload/core_ext/kernel.rb', line 23
def require(file)
to_load = nil
if ::File.absolute_path(file) == file
to_load = Onload.unprocessed_file_for(file)
elsif file.start_with?(".#{::File::SEPARATOR}")
abs_path = ::File.expand_path(file)
to_load = Onload.unprocessed_file_for(abs_path)
else
[$LOAD_PATH[-1]].each do |lp|
check_path = ::File.expand_path(::File.join(lp, file))
if (unprocessed_file = Onload.unprocessed_file_for(check_path))
to_load = unprocessed_file
break
end
end
end
return super(file) unless to_load
return super(file) if Onload::UNLOADABLE_EXTENSIONS.include?(::File.extname(to_load))
return false if $LOADED_FEATURES.include?(to_load)
Kernel.load(to_load)
$LOADED_FEATURES << to_load
return true
end
|