class Sentry::Backtrace::Line

Handles backtrace parsing line by line

Constants

JAVA_INPUT_FORMAT

org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)

RB_EXTENSION
RUBY_INPUT_FORMAT

regexp (optional leading X: on windows, or JRuby9000 class-prefix)

Attributes

file[R]

The file portion of the line (such as app/models/user.rb)

in_app_pattern[R]
method[R]

The method of the line (such as index)

module_name[R]

The module name (JRuby)

number[R]

The line number portion of the line

Public Class Methods

new(file, number, method, module_name, in_app_pattern) click to toggle source
# File lib/sentry/backtrace.rb, line 51
def initialize(file, number, method, module_name, in_app_pattern)
  @file = file
  @module_name = module_name
  @number = number.to_i
  @method = method
  @in_app_pattern = in_app_pattern
end
parse(unparsed_line, in_app_pattern) click to toggle source

Parses a single line of a given backtrace @param [String] unparsed_line The raw line from caller or some backtrace @return [Line] The parsed backtrace line

# File lib/sentry/backtrace.rb, line 38
def self.parse(unparsed_line, in_app_pattern)
  ruby_match = unparsed_line.match(RUBY_INPUT_FORMAT)
  if ruby_match
    _, file, number, method = ruby_match.to_a
    file.sub!(/\.class$/, RB_EXTENSION)
    module_name = nil
  else
    java_match = unparsed_line.match(JAVA_INPUT_FORMAT)
    _, module_name, method, file, number = java_match.to_a
  end
  new(file, number, method, module_name, in_app_pattern)
end

Public Instance Methods

==(other) click to toggle source
# File lib/sentry/backtrace.rb, line 72
def ==(other)
  to_s == other.to_s
end
in_app() click to toggle source
# File lib/sentry/backtrace.rb, line 59
def in_app
  if file =~ in_app_pattern
    true
  else
    false
  end
end
inspect() click to toggle source
# File lib/sentry/backtrace.rb, line 76
def inspect
  "<Line:#{self}>"
end
to_s() click to toggle source

Reconstructs the line in a readable fashion

# File lib/sentry/backtrace.rb, line 68
def to_s
  "#{file}:#{number}:in `#{method}'"
end