summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-11-10 19:40:07 +0900
committerKOBAYASHI Shuji <[email protected]>2019-11-10 19:40:07 +0900
commitb5946822af996103ebc58fae0f63dd8b345f5a1f (patch)
tree996fe7d9a246621b0b32b40eadf1f2d4178d52cb /lib
parentcc54257de58696173ac1bd7f9f5494bb030c1c8f (diff)
downloadmruby-b5946822af996103ebc58fae0f63dd8b345f5a1f.tar.gz
mruby-b5946822af996103ebc58fae0f63dd8b345f5a1f.zip
Defer getting `caller_dir` until needed in `MRuby::LoadGems#gem`
Diffstat (limited to 'lib')
-rw-r--r--lib/mruby/build/load_gems.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/mruby/build/load_gems.rb b/lib/mruby/build/load_gems.rb
index 9f09167ba..f6deb5168 100644
--- a/lib/mruby/build/load_gems.rb
+++ b/lib/mruby/build/load_gems.rb
@@ -13,13 +13,12 @@ module MRuby
end
def gem(gemdir, &block)
- caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1]))
-
if gemdir.is_a?(Hash)
gemdir = load_special_path_gem(gemdir)
elsif GemBox.path && gemdir.is_a?(String)
gemdir = File.expand_path(gemdir, File.dirname(GemBox.path))
else
+ caller_dir = File.expand_path(File.dirname(caller(1,1)[0][/^(.*?):\d/,1]))
gemdir = File.expand_path(gemdir, caller_dir)
end