Sha256: 455e05ba6f3bf7963a63e5fbaa909fe54724af25b6c36ece5c1b8241ec162ad4
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
module BetterRailsDebugger class TracePointItem include Mongoid::Document belongs_to :group_instance, class_name: "::BetterRailsDebugger::GroupInstance" field :source_file, type: String field :source_line, type: Integer field :method_id, type: String field :event, type: String def to_s "#{source_file}:#{source_line}" end def self.backtraces_for(group_instance_id, file, line) backtraces = [] last_source = ::BetterRailsDebugger::TracePointItem.where(group_instance_id: group_instance_id).first current_backtrace = [] current_backtrace_sources = [] ::BetterRailsDebugger::TracePointItem.where(group_instance_id: group_instance_id).to_a[1..-1].each do |bkt| if bkt.source_file == file and bkt.source_line == line backtraces.push current_backtrace.dup.concat([[file, line, bkt.method_id]]) # When we detect that we change the file and is not a method return (back to an old source file) elsif bkt.event.to_s == 'call' current_backtrace.push([last_source.source_file, last_source.source_line, last_source.method_id]) current_backtrace_sources.push last_source.source_line elsif bkt.event.to_s == 'return' current_backtrace.pop current_backtrace_sources.pop end last_source = bkt end backtraces.uniq end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
better_rails_debugger-0.2.1 | app/models/better_rails_debugger/trace_point_item.rb |