Created
June 15, 2017 10:25
-
-
Save garmoshka-mo/c451245b8ecb30abc974f0cca4cb588b to your computer and use it in GitHub Desktop.
Make sane backtrace in byebug
This file contains 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
Byebug::WhereCommand.class_eval do | |
def get_backtrace | |
(context.stack_size-1).downto(0).map do |index| | |
hash = Byebug::Frame.new(context, index).to_hash | |
path = hash[:file].gsub(Rails.root.to_s, '') | |
next if path.match BACKTRACE_TRASH | |
"#{hash[:mark]} #{path}:#{hash[:line]} #{hash[:call]}" | |
end.compact | |
end | |
def print_backtrace | |
print get_backtrace.join "\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment