Class: Opbeat::ErrorMessage::Stacktrace::Frame

Inherits:
Struct
  • Object
show all
Defined in:
lib/opbeat/error_message/stacktrace.rb

Constant Summary collapse

BACKTRACE_REGEX =
/^(.+?):(\d+)(?::in `(.+?)')?$/.freeze

Class Method Summary collapse

Methods inherited from Struct

#to_h

Class Method Details

.from_line(config, line) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/opbeat/error_message/stacktrace.rb', line 31

def from_line config, line
  _, abs_path, lineno, function = line.match(BACKTRACE_REGEX).to_a
  lineno = lineno.to_i
  filename = strip_load_path(abs_path)

  if lines = config.context_lines
    pre_context, context_line, post_context =
      get_contextlines(abs_path, lineno, lines)
  end

  new filename, lineno, abs_path, function, nil,
    pre_context, context_line, post_context
end