Class: Trackets::Backtrace

Inherits:
Object
  • Object
show all
Defined in:
lib/trackets/backtrace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backtrace) ⇒ Backtrace

Returns a new instance of Backtrace.



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

def initialize(backtrace)
  @backtrace = backtrace
end

Instance Attribute Details

#backtraceObject (readonly)

Returns the value of attribute backtrace.



4
5
6
# File 'lib/trackets/backtrace.rb', line 4

def backtrace
  @backtrace
end

Instance Method Details

#parseObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/trackets/backtrace.rb', line 10

def parse
  backtrace.map do |line|
    next if line =~ %r{lib/trackets}

    line.sub!(Trackets.configuration.project_root, "[PROJECT_ROOT]") if Trackets.configuration.project_root

    if defined?(Gem)
      Gem.path.inject(line) { |current, path| current.sub(path, "[GEM_ROOT]") }
    end
  end.compact
end