Class: InfluxReporter::ErrorMessage::Stacktrace::Frame

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.from_line(config, line) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/influx_reporter/error_message/stacktrace.rb', line 33

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