summaryrefslogtreecommitdiff
path: root/prelude.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-16 13:23:15 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-16 13:23:15 +0000
commit02689d147d46776a379b8e31cf0c817bf153da9d (patch)
treeba841ed9276011ba7c83c2ee80b2e33709640c77 /prelude.rb
parent78fea697769ce47a87c92f9baee8621f48f8ace3 (diff)
* prelude.rb (require_relative): defined as a module function of
Kernel. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'prelude.rb')
-rw-r--r--prelude.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/prelude.rb b/prelude.rb
index fdf401b56a..a9e9e3c23e 100644
--- a/prelude.rb
+++ b/prelude.rb
@@ -23,13 +23,16 @@ 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}"
+module Kernel
+ module_function
+ 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
- absolute_feature = File.expand_path(File.join(File.dirname(file), relative_feature))
- require absolute_feature
end