Module: Shiba::Backtrace

Defined in:
lib/shiba/backtrace.rb

Class Method Summary collapse

Class Method Details

.clean!(line) ⇒ Object



23
24
25
26
# File 'lib/shiba/backtrace.rb', line 23

def self.clean!(line)
  line.sub!(backtrace_clean_pattern, '')
  line
end

.from_appObject

8 backtrace lines starting from the app caller, cleaned of app/project cruft.



12
13
14
15
16
17
18
19
20
21
# File 'lib/shiba/backtrace.rb', line 12

def self.from_app
  app_line_idx = caller_locations.index { |line| line.to_s !~ ignore_pattern }
  if app_line_idx == nil
    return
  end

  caller_locations(app_line_idx+1, 8).map do |loc|
    clean!(loc.to_s)
  end
end

.ignoreObject



6
7
8
9
# File 'lib/shiba/backtrace.rb', line 6

def self.ignore
  @ignore ||= [ '.rvm', 'gem', 'vendor', 'rbenv', 'seed',
    'db', 'test', 'spec', 'lib/shiba' ]
end