Class: Batbugger::Backtrace
- Inherits:
-
Object
- Object
- Batbugger::Backtrace
- Defined in:
- lib/batbugger/backtrace.rb
Defined Under Namespace
Classes: Line
Instance Attribute Summary collapse
-
#application_lines ⇒ Object
readonly
Returns the value of attribute application_lines.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#initialize(lines) ⇒ Backtrace
constructor
A new instance of Backtrace.
- #inspect ⇒ Object
- #to_ary ⇒ Object (also: #to_a)
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(lines) ⇒ Backtrace
Returns a new instance of Backtrace.
94 95 96 97 |
# File 'lib/batbugger/backtrace.rb', line 94 def initialize(lines) self.lines = lines self.application_lines = lines.select(&:application?) end |
Instance Attribute Details
#application_lines ⇒ Object
Returns the value of attribute application_lines.
82 83 84 |
# File 'lib/batbugger/backtrace.rb', line 82 def application_lines @application_lines end |
#lines ⇒ Object
Returns the value of attribute lines.
82 83 84 |
# File 'lib/batbugger/backtrace.rb', line 82 def lines @lines end |
Class Method Details
.parse(ruby_backtrace, opts = {}) ⇒ Object
84 85 86 87 88 89 90 91 92 |
# File 'lib/batbugger/backtrace.rb', line 84 def self.parse(ruby_backtrace, opts = {}) ruby_lines = split_multiline_backtrace(ruby_backtrace) lines = ruby_lines.collect do |unparsed_line| Line.parse(unparsed_line, opts) end.compact instance = new(lines) end |
Instance Method Details
#==(other) ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/batbugger/backtrace.rb', line 116 def ==(other) if other.respond_to?(:to_json) to_json == other.to_json else false end end |
#as_json(options = {}) ⇒ Object
104 105 106 |
# File 'lib/batbugger/backtrace.rb', line 104 def as_json( = {}) to_ary end |
#inspect ⇒ Object
112 113 114 |
# File 'lib/batbugger/backtrace.rb', line 112 def inspect "<Backtrace: " + lines.collect { |line| line.inspect }.join(", ") + ">" end |
#to_ary ⇒ Object Also known as: to_a
99 100 101 |
# File 'lib/batbugger/backtrace.rb', line 99 def to_ary lines.map { |l| { :number => l.filtered_number, :file => l.filtered_file, :method => l.filtered_method } } end |
#to_json(*a) ⇒ Object
108 109 110 |
# File 'lib/batbugger/backtrace.rb', line 108 def to_json(*a) as_json.to_json(*a) end |