class Sentry::Backtrace

Front end to parsing the backtrace for each notice

Constants

APP_DIRS_PATTERN

Attributes

lines[R]

holder for an Array of Backtrace::Line instances

Public Class Methods

new(lines) click to toggle source
# File lib/sentry/backtrace.rb, line 102
def initialize(lines)
  @lines = lines
end
parse(backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_callback) click to toggle source
# File lib/sentry/backtrace.rb, line 86
def self.parse(backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_callback)
  ruby_lines = backtrace.is_a?(Array) ? backtrace : backtrace.split(/\n\s*/)

  ruby_lines = backtrace_cleanup_callback.call(ruby_lines) if backtrace_cleanup_callback

  in_app_pattern ||= begin
    Regexp.new("^(#{project_root}/)?#{app_dirs_pattern || APP_DIRS_PATTERN}")
  end

  lines = ruby_lines.to_a.map do |unparsed_line|
    Line.parse(unparsed_line, in_app_pattern)
  end

  new(lines)
end

Public Instance Methods

==(other) click to toggle source
# File lib/sentry/backtrace.rb, line 118
def ==(other)
  if other.respond_to?(:lines)
    lines == other.lines
  else
    false
  end
end
inspect() click to toggle source
# File lib/sentry/backtrace.rb, line 106
def inspect
  "<Backtrace: " + lines.map(&:inspect).join(", ") + ">"
end
to_s() click to toggle source
# File lib/sentry/backtrace.rb, line 110
def to_s
  content = []
  lines.each do |line|
    content << line
  end
  content.join("\n")
end