class Honeybadger::Backtrace
@api private Front end to parsing the backtrace for each notice.
Attributes
application_lines[RW]
Holder for an Array of Backtrace::Line
instances.
lines[RW]
Holder for an Array of Backtrace::Line
instances.
Public Class Methods
new(lines)
click to toggle source
# File lib/honeybadger/backtrace.rb, line 126 def initialize(lines) self.lines = lines self.application_lines = lines.select(&:application?) end
parse(ruby_backtrace, opts = {})
click to toggle source
# 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
split_multiline_backtrace(backtrace)
click to toggle source
# File lib/honeybadger/backtrace.rb, line 173 def self.split_multiline_backtrace(backtrace) if backtrace.size == 1 backtrace.first.to_s.split(/\n\s*/) else backtrace end end
Public Instance Methods
==(other)
click to toggle source
# 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 = {})
click to toggle source
inspect()
click to toggle source
# File lib/honeybadger/backtrace.rb, line 157 def inspect "<Backtrace: " + lines.collect { |line| line.inspect }.join(", ") + ">" end
to_ary()
click to toggle source
Convert Backtrace
to arry.
Returns¶ ↑
Returns array containing backtrace lines.
# 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
Also aliased as: to_a
to_json(*a)
click to toggle source
to_s()
click to toggle source
# File lib/honeybadger/backtrace.rb, line 153 def to_s lines.map(&:to_s).join("\n") end