Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

_file_ and _line_ are not properly updated for rbx core methods #524

Closed
banister opened this Issue Apr 11, 2012 · 3 comments

Comments

Projects
None yet
2 participants
Owner

banister commented Apr 11, 2012


[12] (pry) main: 0> $ String#chop

From: kernel/common/string.rb @ line 482:
Number of lines: 4
Owner: String
Visibility: public

def chop
  str = dup
  str.chop! || str
end
[13] (pry) main: 0> cat #{_file_}
Error: Cannot open "/Users/john/ruby/projects/pry/kernel/common/string.rb" for reading.
[14] (pry) main: 0> 
Member

redgetan commented Apr 13, 2012

Apparently a bug in rubinius' UnboundMethod#source_location method

On ruby-1.9.3-p125

1.9.3p125 :001 > require 'set'
=> true
1.9.3p125 :002 > Set.instance_method(:superset?).source_location
=> ["/Users/reg/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/set.rb", 190]

On rbx-1.2.4-20110705

rubinius-1.2.4 :001 > require 'set'
=> true
rubinius-1.2.4 :002 > Set.instance_method(:superset?).source_location
=> ["lib/set.rb", 163]

@banister banister closed this in 74d3d0d Apr 13, 2012

Owner

banister commented Apr 13, 2012

@redgetan cheers. The issue is that rbx truncates its stdlib/core file paths as they're not guaranteed to be distributed with the binary. However in most cases they will be (as rvm keeps source around and so does rbenv afaik) - so i reconstruct the actual path based on a few rules of thumb.

Member

redgetan commented Apr 13, 2012

Ic. Interesting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment