Class: Raven::Backtrace
- Inherits:
-
Object
- Object
- Raven::Backtrace
- Defined in:
- lib/raven/backtrace.rb
Overview
Front end to parsing the backtrace for each notice
Defined Under Namespace
Classes: Line
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.
106 107 108 |
# File 'lib/raven/backtrace.rb', line 106 def initialize(lines) self.lines = lines end |
Instance Attribute Details
#lines ⇒ Object
holder for an Array of Backtrace::Line instances
87 88 89 |
# File 'lib/raven/backtrace.rb', line 87 def lines @lines end |
Class Method Details
.parse(ruby_backtrace, opts = {}) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/raven/backtrace.rb', line 89 def self.parse(ruby_backtrace, opts = {}) ruby_lines = split_multiline_backtrace(ruby_backtrace) 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
122 123 124 125 126 127 128 |
# File 'lib/raven/backtrace.rb', line 122 def ==(other) if other.respond_to?(:lines) lines == other.lines else false end end |
#inspect ⇒ Object
110 111 112 |
# File 'lib/raven/backtrace.rb', line 110 def inspect "<Backtrace: " + lines.map { |line| line.inspect }.join(", ") + ">" end |
#to_s ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/raven/backtrace.rb', line 114 def to_s content = [] lines.each do |line| content << line end content.join("\n") end |