Module: Minitest::Heat::Backtrace::LineParser

Defined in:
lib/minitest/heat/backtrace/line_parser.rb

Overview

Represents a line from a backtrace to provide more convenient access to information about

the relevant file and line number for displaying in test results

Class Method Summary collapse

Class Method Details

.read(raw_text) ⇒ Object

Parses a line from a backtrace in order to convert it to usable components



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

def self.read(raw_text)
  raw_pathname, raw_line_number, raw_container = raw_text.split(':')
  raw_container = raw_container&.delete_prefix('in `')&.delete_suffix("'")

  ::Minitest::Heat::Location.new(
    pathname: raw_pathname,
    line_number: raw_line_number,
    container: raw_container
  )
end