Created
March 18, 2009 05:45
-
-
Save shri-zz/80965 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def location e | |
# | |
# shri - Add this line since backtrace is sometimes nil (bug) | |
# | |
if not e.backtrace then return "" end | |
last_before_assertion = "" | |
e.backtrace.reverse_each do |s| | |
break if s =~ /in .(assert|refute|flunk|pass|fail|raise)/ | |
last_before_assertion = s | |
end | |
last_before_assertion.sub(/:in .*$/, '') | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment