Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.2
-
Component/s: Core Classes/Modules
-
Labels:None
Description
So, say you have two files, foo1.rb and foo2.rb.
In foo1.rb:
eval(<<DEPS, binding, "deps")
class Object
def require(file)
super
end
end
DEPS
def something(&block)
eval("__FILE__", block.binding)
end
p eval("something { }", binding, "blah")
require 'foo2'
and in foo2.rb:
p "./foo2.rb" == (something { })
This should produce the output
"blah" true
but instead generates
"foo1.rb" false
Note that using eval to redefine require is just to avoid having three files. You could place the code in the string DEPS in a separate file and require that file, and the same effect would happen. It seems that the overriding of require in some way doesn't pass along the correct name information.
This breaks when using "dust" with ActiveSupport, and also breaks JtestR (which uses dust and ActiveSupport).
Interestingly enough, if I change the code to
alias old_require require def require(file) old_require(file) endit produces the SAME problem. So it's not something with regards to the super or zsuper calls.
alias old_require require def require(file) old_require(file) end