class Honeybadger::Backtrace

Front end to parsing the backtrace for each notice.
@api private

def self.parse(ruby_backtrace, opts = {})

def self.parse(ruby_backtrace, opts = {})
  ruby_lines = split_multiline_backtrace(ruby_backtrace.to_a)
  lines = ruby_lines.collect do |unparsed_line|
    Line.parse(unparsed_line.to_s, opts)
  end.compact
  instance = new(lines)
end

def self.split_multiline_backtrace(backtrace)

def self.split_multiline_backtrace(backtrace)
  if backtrace.size == 1
    backtrace.first.to_s.split(/\n\s*/)
  else
    backtrace
  end
end

def ==(other)

def ==(other)
  if other.respond_to?(:to_json)
    to_json == other.to_json
  else
    false
  end
end

def as_json(options = {})

Returns JSON representation of backtrace.

JSON support.
def as_json(options = {})
  to_ary
end

def initialize(lines)

def initialize(lines)
  self.lines = lines
  self.application_lines = lines.select(&:application?)
end

def inspect

def inspect
  "<Backtrace: " + lines.collect { |line| line.inspect }.join(", ") + ">"
end

def to_ary

Returns array containing backtrace lines.

Convert Backtrace to arry.
def to_ary
  lines.take(1000).map { |l| { :number => l.filtered_number, :file => l.filtered_file, :method => l.filtered_method, :source => l.source } }
end

def to_json(*a)

Returns valid JSON representation of backtrace.

Creates JSON.
def to_json(*a)
  as_json.to_json(*a)
end

def to_s

def to_s
  lines.map(&:to_s).join("\n")
end