class Sentry::Backtrace::Line
Handles backtrace parsing line by line
def self.from_source_location(location, in_app_pattern = nil)
-
(Line)- The backtrace line
Parameters:
-
in_app_pattern(Regexp, nil) -- Optional pattern to determine if the line is in-app -
location(Thread::Backtrace::Location) -- The location object
def self.from_source_location(location, in_app_pattern = nil) file = location.absolute_path number = location.lineno method = location.base_label label = location.label index = label.index("#") || label.index(".") module_name = label[0, index] if index new(file, number, method, module_name, in_app_pattern) end
def self.parse(unparsed_line, in_app_pattern = nil)
-
(Line)- The parsed backtrace line
Parameters:
-
unparsed_line(String) -- The raw line from +caller+ or some backtrace
def self.parse(unparsed_line, in_app_pattern = nil) ruby_match = unparsed_line.match(RUBY_INPUT_FORMAT) if ruby_match _, file, number, _, module_name, method = ruby_match.to_a file.sub!(/\.class$/, RB_EXTENSION) module_name = module_name 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
def ==(other)
def ==(other) to_s == other.to_s end
def in_app
def in_app return false unless in_app_pattern if file =~ in_app_pattern true else false end end
def initialize(file, number, method, module_name, in_app_pattern)
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
def inspect
def inspect "<Line:#{self}>" end
def to_s
def to_s "#{file}:#{number}:in `#{method}'" end