1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Workaround for rubinius binding __FILE__ bug #1581

* This fix works by storing the actual file in an ivar on the binding
* see https://github.com/rubinius/rubinius/issues/1581
This commit is contained in:
John Mair 2012-03-02 03:59:27 +13:00
parent b06cab60a4
commit 0b457ba9fa
2 changed files with 5 additions and 2 deletions

View file

@ -30,9 +30,10 @@ class Pry
file = target.eval('__FILE__')
line_num = target.eval('__LINE__')
if rbx?
if file =~ /__unknown__/
file = RbxPath.convert_path_to_full(target.variables.method.file.to_s)
if !target.instance_variable_defined?(:@__actual_file__)
target.instance_variable_set(:@__actual_file__, RbxPath.convert_path_to_full(target.variables.method.file.to_s))
end
file = target.instance_variable_get(:@__actual_file__).to_s
end
[file, line_num]

View file

@ -10,6 +10,8 @@ class Pry
File.join File.dirname(Rubinius::KERNEL_PATH), path
elsif path.start_with?("lib")
File.join File.dirname(Rubinius::LIB_PATH), path
else
path
end
end