Class: HoptoadNotifier::Backtrace
- Inherits:
-
Object
- Object
- HoptoadNotifier::Backtrace
- Defined in:
- lib/hoptoad_notifier/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
Constructor Details
#initialize(lines) ⇒ Backtrace
Returns a new instance of Backtrace.
71 72 73 |
# File 'lib/hoptoad_notifier/backtrace.rb', line 71 def initialize(lines) self.lines = lines end |
Instance Attribute Details
#lines ⇒ Object
holder for an Array of Backtrace::Line instances
52 53 54 |
# File 'lib/hoptoad_notifier/backtrace.rb', line 52 def lines @lines end |
Class Method Details
.parse(ruby_backtrace, opts = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/hoptoad_notifier/backtrace.rb', line 54 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.inject(line) do |line, proc| proc.call(line) end end.compact lines = filtered_lines.collect do |unparsed_line| Line.parse(unparsed_line) end instance = new(lines) end |
Instance Method Details
#==(other) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/hoptoad_notifier/backtrace.rb', line 79 def ==(other) if other.respond_to?(:lines) lines == other.lines else false end end |
#inspect ⇒ Object
75 76 77 |
# File 'lib/hoptoad_notifier/backtrace.rb', line 75 def inspect "<Backtrace: " + lines.collect { |line| line.inspect }.join(", ") + ">" end |