Class: Minitest::Heat::Backtrace
- Inherits:
-
Object
- Object
- Minitest::Heat::Backtrace
- Defined in:
- lib/minitest/heat/backtrace.rb,
lib/minitest/heat/backtrace/line_count.rb,
lib/minitest/heat/backtrace/line_parser.rb
Overview
Wrapper for separating backtrace into component parts
Defined Under Namespace
Modules: LineParser Classes: LineCount
Instance Attribute Summary collapse
-
#raw_backtrace ⇒ Object
readonly
Returns the value of attribute raw_backtrace.
Instance Method Summary collapse
-
#empty? ⇒ Boolean
Determines if the raw backtrace has values in it.
-
#initialize(raw_backtrace) ⇒ self
constructor
Creates a more flexible backtrace data structure by parsing the lines of the backtrace to extract specific subsets of lines for investigating the offending files and line numbers.
-
#locations ⇒ Array<Location>
All lines of the backtrace converted to Backtrace::LineParser’s.
-
#project_locations ⇒ Array<Location>
All entries from the backtrace that are files within the project.
-
#recently_modified_locations ⇒ Array<Location>
All entries from the backtrace within the project and sorted with the most recently modified files at the beginning.
-
#source_code_locations ⇒ Array<Location>
All source code entries from the backtrace (i.e. excluding tests).
-
#test_locations ⇒ Array<Location>
All entries from the backtrace within the project tests.
Constructor Details
#initialize(raw_backtrace) ⇒ self
Creates a more flexible backtrace data structure by parsing the lines of the backtrace to
extract specific subsets of lines for investigating the offending files and line numbers
17 18 19 |
# File 'lib/minitest/heat/backtrace.rb', line 17 def initialize(raw_backtrace) @raw_backtrace = Array(raw_backtrace) end |
Instance Attribute Details
#raw_backtrace ⇒ Object (readonly)
Returns the value of attribute raw_backtrace.
10 11 12 |
# File 'lib/minitest/heat/backtrace.rb', line 10 def raw_backtrace @raw_backtrace end |
Instance Method Details
#empty? ⇒ Boolean
Determines if the raw backtrace has values in it
24 25 26 |
# File 'lib/minitest/heat/backtrace.rb', line 24 def empty? raw_backtrace.empty? end |
#locations ⇒ Array<Location>
All lines of the backtrace converted to Backtrace::LineParser’s
31 32 33 34 35 |
# File 'lib/minitest/heat/backtrace.rb', line 31 def locations return [] if raw_backtrace.nil? @locations ||= raw_backtrace.map { |entry| Backtrace::LineParser.read(entry) } end |
#project_locations ⇒ Array<Location>
All entries from the backtrace that are files within the project
48 49 50 |
# File 'lib/minitest/heat/backtrace.rb', line 48 def project_locations @project_locations ||= locations.select(&:project_file?) end |
#recently_modified_locations ⇒ Array<Location>
All entries from the backtrace within the project and sorted with the most recently modified
files at the beginning
41 42 43 |
# File 'lib/minitest/heat/backtrace.rb', line 41 def recently_modified_locations @recently_modified_locations ||= project_locations.sort_by(&:mtime).reverse end |
#source_code_locations ⇒ Array<Location>
All source code entries from the backtrace (i.e. excluding tests)
62 63 64 |
# File 'lib/minitest/heat/backtrace.rb', line 62 def source_code_locations @source_code_locations ||= project_locations.select(&:source_code_file?) end |
#test_locations ⇒ Array<Location>
All entries from the backtrace within the project tests
55 56 57 |
# File 'lib/minitest/heat/backtrace.rb', line 55 def test_locations @test_locations ||= project_locations.select(&:test_file?) end |