Class: CrashLog::Backtrace
- Inherits:
-
Object
- Object
- CrashLog::Backtrace
- Defined in:
- lib/crash_log/backtrace.rb,
lib/crash_log/backtrace/line.rb,
lib/crash_log/backtrace/line_cache.rb
Defined Under Namespace
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_a ⇒ Object
Constructor Details
#initialize(lines) ⇒ Backtrace
Returns a new instance of Backtrace.
32 33 34 |
# File 'lib/crash_log/backtrace.rb', line 32 def initialize(lines) self.lines = lines end |
Instance Attribute Details
#lines ⇒ Object
holder for an Array of Backtrace::Line instances
8 9 10 |
# File 'lib/crash_log/backtrace.rb', line 8 def lines @lines end |
Class Method Details
.parse(ruby_backtrace, opts = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/crash_log/backtrace.rb', line 10 def self.parse(ruby_backtrace, opts = {}) ruby_lines = split_multiline_backtrace(ruby_backtrace) lines = ruby_lines.to_a.map do |unparsed_line| Line.parse(unparsed_line) end filters = opts[:filters] || [] lines.each do |line| filters.each do |filter| line.apply_filter(filter) end end lines = lines.reject do |line| line.marked_for_deletion? end instance = new(lines) end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/crash_log/backtrace.rb', line 40 def ==(other) if other.respond_to?(:lines) lines == other.lines else false end end |
#inspect ⇒ Object
36 37 38 |
# File 'lib/crash_log/backtrace.rb', line 36 def inspect "<Backtrace: " + lines.map { |line| line.inspect }.join(", ") + ">" end |
#to_a ⇒ Object
48 49 50 51 52 |
# File 'lib/crash_log/backtrace.rb', line 48 def to_a lines.map do |line| line.to_hash end end |