Class: Minitest::Heat::Backtrace::LineCount
- Inherits:
-
Object
- Object
- Minitest::Heat::Backtrace::LineCount
- Defined in:
- lib/minitest/heat/backtrace/line_count.rb
Overview
Determines an optimal line count for backtrace locations in order to have relevant
information but keep the backtrace as compact as possible
Constant Summary collapse
- DEFAULT_LINE_COUNT =
20
Instance Attribute Summary collapse
-
#locations ⇒ Object
Returns the value of attribute locations.
Instance Method Summary collapse
- #earliest_project_location ⇒ Object
-
#initialize(locations) ⇒ LineCount
constructor
A new instance of LineCount.
- #limit ⇒ Object
- #max_location ⇒ Object
Constructor Details
#initialize(locations) ⇒ LineCount
Returns a new instance of LineCount.
13 14 15 |
# File 'lib/minitest/heat/backtrace/line_count.rb', line 13 def initialize(locations) @locations = locations end |
Instance Attribute Details
#locations ⇒ Object
Returns the value of attribute locations.
11 12 13 |
# File 'lib/minitest/heat/backtrace/line_count.rb', line 11 def locations @locations end |
Instance Method Details
#earliest_project_location ⇒ Object
17 18 19 |
# File 'lib/minitest/heat/backtrace/line_count.rb', line 17 def earliest_project_location locations.rindex { |element| element.project_file? } end |
#limit ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/minitest/heat/backtrace/line_count.rb', line 25 def limit [ DEFAULT_LINE_COUNT, earliest_project_location, max_location ].compact.min end |
#max_location ⇒ Object
21 22 23 |
# File 'lib/minitest/heat/backtrace/line_count.rb', line 21 def max_location locations.size - 1 end |