Class: Sentry::Backtrace
Overview
Front end to parsing the backtrace for each notice
Defined Under Namespace
Classes: Line
Constant Summary collapse
- APP_DIRS_PATTERN =
/(bin|exe|app|config|lib|test)/.freeze
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
holder for an Array of Backtrace::Line instances.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(lines) ⇒ Backtrace
constructor
A new instance of Backtrace.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(lines) ⇒ Backtrace
Returns a new instance of Backtrace.
102 103 104 |
# File 'lib/sentry/backtrace.rb', line 102 def initialize(lines) @lines = lines end |
Instance Attribute Details
#lines ⇒ Object (readonly)
holder for an Array of Backtrace::Line instances
84 85 86 |
# File 'lib/sentry/backtrace.rb', line 84 def lines @lines end |
Class Method Details
.parse(backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_callback) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/sentry/backtrace.rb', line 86 def self.parse(backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_callback) ruby_lines = backtrace.is_a?(Array) ? backtrace : backtrace.split(/\n\s*/) ruby_lines = backtrace_cleanup_callback.call(ruby_lines) if backtrace_cleanup_callback in_app_pattern ||= begin Regexp.new("^(#{project_root}/)?#{app_dirs_pattern || APP_DIRS_PATTERN}") end lines = ruby_lines.to_a.map do |unparsed_line| Line.parse(unparsed_line, in_app_pattern) end new(lines) end |
Instance Method Details
#==(other) ⇒ Object
118 119 120 121 122 123 124 |
# File 'lib/sentry/backtrace.rb', line 118 def ==(other) if other.respond_to?(:lines) lines == other.lines else false end end |
#inspect ⇒ Object
106 107 108 |
# File 'lib/sentry/backtrace.rb', line 106 def inspect "<Backtrace: " + lines.map(&:inspect).join(", ") + ">" end |
#to_s ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/sentry/backtrace.rb', line 110 def to_s content = [] lines.each do |line| content << line end content.join("\n") end |