mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* prelude.rb (require_relative): move require_relative from
lib/require_relative.rb. [ruby-core:16356] * lib/require_relative.rb: removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7b4a171158
commit
6b36f117f2
12 changed files with 17 additions and 20 deletions
10
prelude.rb
10
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue