lib/raven/backtrace.rb in sentry-raven-0.4.6 vs lib/raven/backtrace.rb in sentry-raven-0.4.7
- old
+ new
@@ -9,11 +9,11 @@
class Line
# regexp (optionnally allowing leading X: for windows support)
INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$}.freeze
- APP_DIRS_PATTERN = /^\/?(bin|app|config|lib|test)/
+ APP_DIRS_PATTERN = /^(bin|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
@@ -35,14 +35,19 @@
self.number = number.to_i
self.method = method
end
def in_app
- if self.file =~ APP_DIRS_PATTERN
+ if (project_root && self.file.start_with?(project_root)) ||
+ (self.file =~ APP_DIRS_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}'"