blob: e68546f1ce670bd595ffc5fa67826c94490a7d39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
def require_relative(relative_feature)
c = caller.first
e = c.rindex(/:\d+:in /)
file = $`
if /\A\((.*)\)/ =~ file # eval, etc.
raise LoadError, "require_relative is called in #{$1}"
end
absolute_feature = File.expand_path(File.join(File.dirname(file), relative_feature))
require absolute_feature
end
|