Sha256: fdfdb7ad16e184dbb8ef05948bab0c96002fec00c4a1160124fee476672764f9
Contents?: true
Size: 812 Bytes
Versions: 4
Compression:
Stored size: 812 Bytes
Contents
# frozen_string_literal: true module WebConsole class ExceptionMapper def initialize(exception) @backtrace = exception.backtrace @bindings = exception.bindings end def first guess_the_first_application_binding || @bindings.first end def [](index) guess_binding_for_index(index) || @bindings[index] end private def guess_binding_for_index(index) file, line = @backtrace[index].to_s.split(":") line = line.to_i @bindings.find do |binding| binding.eval("__FILE__") == file && binding.eval("__LINE__") == line end end def guess_the_first_application_binding @bindings.find do |binding| binding.eval("__FILE__").to_s.start_with?(Rails.root.to_s) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems