From: "ko1 (Koichi Sasada)" <redmine@...>
Date: 2012-07-14T15:00:12+09:00
Subject: [ruby-core:46414] [ruby-trunk - Bug #4487] require_relative fails in an eval'ed file


Issue #4487 has been updated by ko1 (Koichi Sasada).

Assignee changed from matz (Yukihiro Matsumoto) to mame (Yusuke Endoh)

mame-san, please ask matz.
----------------------------------------
Bug #4487: require_relative fails in an eval'ed file
https://bugs.ruby-lang.org/issues/4487#change-28035

Author: rogerdpack (Roger Pack)
Status: Assigned
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: 
Target version: 
ruby -v: -


=begin
Hello all.
 
 $cat eval_me1.rb
 eval(File.read('eval_me2.rb'), binding, File.expand_path('./eval_me2.rb'))
 $cat eval_me2.rb
 require_relative 'eval_me1.rb'
 $ ruby eval_me1.rb
 C:/dev/ruby/faster_require/spec/eval_me2.rb:1:in `require_relative': cannot infer basepath (LoadError)
        from C:/dev/ruby/faster_require/spec/eval_me2.rb:1:in `<main>'
        from eval_me1.rb:1:in `eval'
        from eval_me1.rb:1:in `<main>'

I suppose was assuming that if eval included a filename, then require_relative would work from within it. Perhaps I am mistaken?
Thanks!
-r
=end



-- 
http://bugs.ruby-lang.org/