class Raven::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[RW]
The file portion of the line (such as app/models/user.rb)
method[RW]
The method of the line (such as index)
module_name[RW]
The module name (JRuby)
number[RW]
The line number portion of the line
Public Class Methods
in_app_pattern()
click to toggle source
# File lib/raven/backtrace.rb, line 77 def self.in_app_pattern @in_app_pattern ||= begin project_root = Raven.configuration.project_root&.to_s Regexp.new("^(#{project_root}/)?#{Raven.configuration.app_dirs_pattern || APP_DIRS_PATTERN}") end end
new(file, number, method, module_name)
click to toggle source
# File lib/raven/backtrace.rb, line 49 def initialize(file, number, method, module_name) self.file = file self.module_name = module_name self.number = number.to_i self.method = method end
parse(unparsed_line)
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/raven/backtrace.rb, line 36 def self.parse(unparsed_line) 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) end
Public Instance Methods
==(other)
click to toggle source
# File lib/raven/backtrace.rb, line 69 def ==(other) to_s == other.to_s end
in_app()
click to toggle source
# File lib/raven/backtrace.rb, line 56 def in_app if file =~ self.class.in_app_pattern true else false end end
inspect()
click to toggle source
# File lib/raven/backtrace.rb, line 73 def inspect "<Line:#{self}>" end
to_s()
click to toggle source
Reconstructs the line in a readable fashion
# File lib/raven/backtrace.rb, line 65 def to_s "#{file}:#{number}:in `#{method}'" end