summaryrefslogtreecommitdiff
path: root/prelude.rb
diff options
context:
space:
mode:
Diffstat (limited to 'prelude.rb')
-rw-r--r--prelude.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/prelude.rb b/prelude.rb
index a38a578595..fdf401b56a 100644
--- a/prelude.rb
+++ b/prelude.rb
@@ -23,3 +23,13 @@ class Thread
end
end
+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