Class: Honeybadger::Backtrace Private
- Inherits:
-
Object
- Object
- Honeybadger::Backtrace
- Defined in:
- lib/honeybadger/backtrace.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Front end to parsing the backtrace for each notice.
Defined Under Namespace
Classes: Line
Instance Attribute Summary collapse
-
#application_lines ⇒ Object
readonly
private
Holder for an Array of Backtrace::Line instances.
-
#lines ⇒ Object
readonly
private
Holder for an Array of Backtrace::Line instances.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object private
-
#as_json(options = {}) ⇒ Object
private
JSON support.
-
#initialize(lines) ⇒ Backtrace
constructor
private
A new instance of Backtrace.
- #inspect ⇒ Object private
-
#to_ary ⇒ Object
(also: #to_a)
private
Convert Backtrace to arry.
-
#to_json(*a) ⇒ Object
private
Creates JSON.
- #to_s ⇒ Object private
Constructor Details
#initialize(lines) ⇒ Backtrace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Backtrace.
126 127 128 129 |
# File 'lib/honeybadger/backtrace.rb', line 126 def initialize(lines) self.lines = lines self.application_lines = lines.select(&:application?) end |
Instance Attribute Details
#application_lines ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Holder for an Array of Backtrace::Line instances.
114 115 116 |
# File 'lib/honeybadger/backtrace.rb', line 114 def application_lines @application_lines end |
#lines ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Holder for an Array of Backtrace::Line instances.
114 115 116 |
# File 'lib/honeybadger/backtrace.rb', line 114 def lines @lines end |
Class Method Details
.parse(ruby_backtrace, opts = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
116 117 118 119 120 121 122 123 124 |
# File 'lib/honeybadger/backtrace.rb', line 116 def self.parse(ruby_backtrace, opts = {}) ruby_lines = split_multiline_backtrace(ruby_backtrace.to_a) lines = ruby_lines.collect do |unparsed_line| Line.parse(unparsed_line.to_s, opts) end.compact instance = new(lines) end |
Instance Method Details
#==(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
161 162 163 164 165 166 167 |
# File 'lib/honeybadger/backtrace.rb', line 161 def ==(other) if other.respond_to?(:to_json) to_json == other.to_json else false end end |
#as_json(options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
JSON support.
Returns JSON representation of backtrace.
142 143 144 |
# File 'lib/honeybadger/backtrace.rb', line 142 def as_json( = {}) to_ary end |
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
157 158 159 |
# File 'lib/honeybadger/backtrace.rb', line 157 def inspect "<Backtrace: " + lines.collect { |line| line.inspect }.join(", ") + ">" end |
#to_ary ⇒ Object Also known as: to_a
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert Backtrace to arry.
Returns array containing backtrace lines.
134 135 136 |
# File 'lib/honeybadger/backtrace.rb', line 134 def to_ary lines.take(1000).map { |l| { :number => l.filtered_number, :file => l.filtered_file, :method => l.filtered_method, :source => l.source } } end |
#to_json(*a) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates JSON.
Returns valid JSON representation of backtrace.
149 150 151 |
# File 'lib/honeybadger/backtrace.rb', line 149 def to_json(*a) as_json.to_json(*a) end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
153 154 155 |
# File 'lib/honeybadger/backtrace.rb', line 153 def to_s lines.map(&:to_s).join("\n") end |