lib/raven/backtrace.rb in sentry-raven-0.15.3 vs lib/raven/backtrace.rb in sentry-raven-0.15.4
- old
+ new
@@ -5,14 +5,14 @@
# Front end to parsing the backtrace for each notice
class Backtrace
# Handles backtrace parsing line by line
class Line
# regexp (optionnally allowing leading X: for windows support)
- RUBY_INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}.freeze
+ RUBY_INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}
# org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
- JAVA_INPUT_FORMAT = %r{^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$}.freeze
+ 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
@@ -82,12 +82,12 @@
end
# holder for an Array of Backtrace::Line instances
attr_reader :lines
- def self.parse(ruby_backtrace, opts = {})
- ruby_lines = split_multiline_backtrace(ruby_backtrace)
+ def self.parse(backtrace, opts = {})
+ ruby_lines = backtrace.is_a?(Array) ? backtrace : backtrace.split(/\n\s*/)
filters = opts[:filters] || []
filtered_lines = ruby_lines.to_a.map do |line|
filters.reduce(line) do |nested_line, proc|
proc.call(nested_line)
@@ -126,15 +126,7 @@
end
private
attr_writer :lines
-
- def self.split_multiline_backtrace(backtrace)
- if backtrace.to_a.size == 1
- backtrace.to_a.first.split(/\n\s*/)
- else
- backtrace
- end
- end
end
end