Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Workaround for rubinius binding __FILE__ bug #1581

* This fix works by storing the actual file in an ivar on the binding
* see rubinius/rubinius#1581
  • Loading branch information...
commit 0b457ba9fa094c6bf2c908ac51f7a24b5d38a97e 1 parent b06cab6
@banister banister authored
Showing with 5 additions and 2 deletions.
  1. +3 −2 lib/pry/helpers/command_helpers.rb
  2. +2 −0  lib/pry/rbx_path.rb
View
5 lib/pry/helpers/command_helpers.rb
@@ -30,9 +30,10 @@ def file_and_line_from_binding(target)
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
2  lib/pry/rbx_path.rb
@@ -10,6 +10,8 @@ def convert_path_to_full(path)
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
Please sign in to comment.
Something went wrong with that request. Please try again.