lib/raven/backtrace.rb in sentry-raven-0.15.6 vs lib/raven/backtrace.rb in sentry-raven-1.0.0
- old
+ new
@@ -10,12 +10,10 @@
RUBY_INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}
# org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
JAVA_INPUT_FORMAT = %r{^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$}
- APP_DIRS_PATTERN = /(bin|exe|app|config|lib|test)/
-
# The file portion of the line (such as app/models/user.rb)
attr_reader :file
# The line number portion of the line
attr_reader :number
@@ -47,24 +45,17 @@
self.number = number.to_i
self.method = method
end
def in_app
- app_dirs = Raven.configuration.app_dirs_pattern || APP_DIRS_PATTERN
- @in_app_pattern ||= Regexp.new("^(#{project_root}/)?#{app_dirs}")
-
- if self.file =~ @in_app_pattern
+ if self.file =~ self.class.in_app_pattern
true
else
false
end
end
- def project_root
- @project_root ||= Raven.configuration.project_root && Raven.configuration.project_root.to_s
- end
-
# Reconstructs the line in a readable fashion
def to_s
"#{file}:#{number}:in `#{method}'"
end
@@ -74,13 +65,22 @@
def inspect
"<Line:#{self}>"
end
+ def self.in_app_pattern
+ @in_app_pattern ||= begin
+ project_root = Raven.configuration.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)/
# holder for an Array of Backtrace::Line instances
attr_reader :lines
def self.parse(backtrace, opts = {})