lib/raven/backtrace.rb in sentry-raven-3.0.0 vs lib/raven/backtrace.rb in sentry-raven-3.0.1
- old
+ new
@@ -1,22 +1,24 @@
+# frozen_string_literal: true
+
## Inspired by Rails' and Airbrake's backtrace parsers.
module Raven
# Front end to parsing the backtrace for each notice
class Backtrace
# Handles backtrace parsing line by line
class Line
- RB_EXTENSION = ".rb".freeze
+ RB_EXTENSION = ".rb"
# regexp (optional leading X: on windows, or JRuby9000 class-prefix)
RUBY_INPUT_FORMAT = /
^ \s* (?: [a-zA-Z]: | uri:classloader: )? ([^:]+ | <.*>):
(\d+)
(?: :in \s `([^']+)')?$
- /x
+ /x.freeze
# org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
- JAVA_INPUT_FORMAT = /^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$/
+ JAVA_INPUT_FORMAT = /^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$/.freeze
# The file portion of the line (such as app/models/user.rb)
attr_reader :file
# The line number portion of the line
@@ -72,20 +74,20 @@
"<Line:#{self}>"
end
def self.in_app_pattern
@in_app_pattern ||= begin
- project_root = Raven.configuration.project_root && Raven.configuration.project_root.to_s
+ project_root = Raven.configuration.project_root&.to_s
Regexp.new("^(#{project_root}/)?#{Raven.configuration.app_dirs_pattern || APP_DIRS_PATTERN}")
end
end
private
attr_writer :file, :number, :method, :module_name
end
- APP_DIRS_PATTERN = /(bin|exe|app|config|lib|test)/
+ APP_DIRS_PATTERN = /(bin|exe|app|config|lib|test)/.freeze
# holder for an Array of Backtrace::Line instances
attr_reader :lines
def self.parse(backtrace, opts = {})