Class: Crashdesk::Backtrace
- Inherits:
-
Object
- Object
- Crashdesk::Backtrace
- Defined in:
- lib/crashdesk/backtrace.rb
Defined Under Namespace
Classes: Line
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #crc ⇒ Object
- #hash_id ⇒ Object
-
#initialize(lines) ⇒ Backtrace
constructor
A new instance of Backtrace.
- #inspect ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(lines) ⇒ Backtrace
Returns a new instance of Backtrace.
57 58 59 |
# File 'lib/crashdesk/backtrace.rb', line 57 def initialize(lines) self.lines = lines end |
Instance Attribute Details
#lines ⇒ Object
Returns the value of attribute lines.
41 42 43 |
# File 'lib/crashdesk/backtrace.rb', line 41 def lines @lines end |
Class Method Details
.parse(backtrace, opts = {}) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/crashdesk/backtrace.rb', line 43 def self.parse(backtrace, opts = {}) code_lines = split_multiline_backtrace(backtrace) lines = unless code_lines.nil? code_lines.collect do |unparsed_line| Line.parse(unparsed_line) end else [] end instance = new(lines) end |
Instance Method Details
#==(other) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/crashdesk/backtrace.rb', line 73 def ==(other) if other.respond_to?(:lines) lines == other.lines else false end end |
#crc ⇒ Object
85 86 87 |
# File 'lib/crashdesk/backtrace.rb', line 85 def crc Zlib::crc32(to_s).to_s end |
#hash_id ⇒ Object
81 82 83 |
# File 'lib/crashdesk/backtrace.rb', line 81 def hash_id Digest::MD5.hexdigest(to_s) end |
#inspect ⇒ Object
61 62 63 |
# File 'lib/crashdesk/backtrace.rb', line 61 def inspect "<Backtrace: " + lines.collect { |line| line.inspect }.join(", ") + ">" end |
#to_a ⇒ Object
69 70 71 |
# File 'lib/crashdesk/backtrace.rb', line 69 def to_a lines.map { |l| l.to_s } end |
#to_s ⇒ Object
65 66 67 |
# File 'lib/crashdesk/backtrace.rb', line 65 def to_s lines.join("\n\s") end |