Class: Raven::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.
113 114 115 |
# File 'lib/raven/backtrace.rb', line 113 def initialize(lines) self.lines = lines end |
Instance Attribute Details
#lines ⇒ Object
holder for an Array of Backtrace::Line instances
92 93 94 |
# File 'lib/raven/backtrace.rb', line 92 def lines @lines end |
Class Method Details
.parse(backtrace, opts = {}) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/raven/backtrace.rb', line 94 def self.parse(backtrace, opts = {}) ruby_lines = backtrace.is_a?(Array) ? backtrace : backtrace.split(/\n\s*/) ruby_lines = opts[:configuration].backtrace_cleanup_callback.call(ruby_lines) if opts[:configuration]&.backtrace_cleanup_callback filters = opts[:filters] || [] filtered_lines = ruby_lines.to_a.map do |line| filters.reduce(line) do |nested_line, proc| proc.call(nested_line) end end.compact lines = filtered_lines.map do |unparsed_line| Line.parse(unparsed_line) end new(lines) end |
Instance Method Details
#==(other) ⇒ Object
129 130 131 132 133 134 135 |
# File 'lib/raven/backtrace.rb', line 129 def ==(other) if other.respond_to?(:lines) lines == other.lines else false end end |
#inspect ⇒ Object
117 118 119 |
# File 'lib/raven/backtrace.rb', line 117 def inspect "<Backtrace: " + lines.map(&:inspect).join(", ") + ">" end |
#to_s ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/raven/backtrace.rb', line 121 def to_s content = [] lines.each do |line| content << line end content.join("\n") end |