21
22
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
|
# File 'lib/rux-rails/core_ext/kernel.rb', line 21
def require(file)
path = nil
rux_file = file.end_with?('.rux') ? file : "#{file}.rux"
if File.absolute_path(rux_file) == rux_file && File.exist?(rux_file)
path = rux_file
elsif rux_file.start_with?(".#{File::SEPARATOR}")
abs_path = File.expand_path(rux_file)
path = abs_path if File.exist?(abs_path)
else
$LOAD_PATH.each do |lp|
check_path = File.expand_path(File.join(lp, rux_file))
if File.exist?(check_path)
path = check_path
break
end
end
end
return super(file) unless path
return false if $LOADED_FEATURES.include?(path)
Kernel.load(path)
$LOADED_FEATURES << path
return true
end
|