Class: Lookout::Results::Error::Exception::Backtrace

Inherits:
Object
  • Object
show all
Defined in:
lib/lookout/results/error/exception/backtrace.rb

Instance Method Summary collapse

Constructor Details

#initialize(backtrace, filter = ENV['LOOKOUT_DO_NOT_FILTER_BACKTRACE'].nil?) ⇒ Backtrace

Returns a new instance of Backtrace.



4
5
6
7
8
9
10
11
# File 'lib/lookout/results/error/exception/backtrace.rb', line 4

def initialize(backtrace, filter = ENV['LOOKOUT_DO_NOT_FILTER_BACKTRACE'].nil?)
  @filter = filter
  @backtrace = case backtrace
               when nil then []
               when String then [backtrace]
               when Array then backtrace.select{ |l| String === l }
               end
end

Instance Method Details

#backtraceObject



13
14
15
16
# File 'lib/lookout/results/error/exception/backtrace.rb', line 13

def backtrace
  return @backtrace unless @filter
  before or outside or @backtrace
end

#to_sObject



18
19
20
# File 'lib/lookout/results/error/exception/backtrace.rb', line 18

def to_s
  backtrace.map{ |location| "\tfrom %s" % location }.join("\n")
end