зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
78fea69776
Коммит
02689d147d
|
@ -1,3 +1,8 @@
|
|||
Fri Oct 16 22:20:25 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* prelude.rb (require_relative): defined as a module function of
|
||||
Kernel.
|
||||
|
||||
Fri Oct 16 20:18:28 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/delegate.rb (Delegator#method_missing): remove backtrace
|
||||
|
|
19
prelude.rb
19
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче