class Batbugger::Backtrace

Attributes

application_lines[RW]
lines[RW]

Public Class Methods

new(lines) click to toggle source
# File lib/batbugger/backtrace.rb, line 94
def initialize(lines)
  self.lines = lines
  self.application_lines = lines.select(&:application?)
end
parse(ruby_backtrace, opts = {}) click to toggle source
# File lib/batbugger/backtrace.rb, line 84
def self.parse(ruby_backtrace, opts = {})
  ruby_lines = split_multiline_backtrace(ruby_backtrace)

  lines = ruby_lines.collect do |unparsed_line|
    Line.parse(unparsed_line, opts)
  end.compact

  instance = new(lines)
end

Private Class Methods

split_multiline_backtrace(backtrace) click to toggle source
# File lib/batbugger/backtrace.rb, line 128
def self.split_multiline_backtrace(backtrace)
  if backtrace.to_a.size == 1
    backtrace.to_a.first.split(/\n\s*/)
  else
    backtrace
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/batbugger/backtrace.rb, line 116
def ==(other)
  if other.respond_to?(:to_json)
    to_json == other.to_json
  else
    false
  end
end
as_json(options = {}) click to toggle source
# File lib/batbugger/backtrace.rb, line 104
def as_json(options = {})
  to_ary
end
inspect() click to toggle source
# File lib/batbugger/backtrace.rb, line 112
def inspect
  "<Backtrace: " + lines.collect { |line| line.inspect }.join(", ") + ">"
end
to_a()
Alias for: to_ary
to_ary() click to toggle source
# File lib/batbugger/backtrace.rb, line 99
def to_ary
  lines.map { |l| { :number => l.filtered_number, :file => l.filtered_file, :method => l.filtered_method } }
end
Also aliased as: to_a
to_json(*a) click to toggle source
# File lib/batbugger/backtrace.rb, line 108
def to_json(*a)
  as_json.to_json(*a)
end