Class: Minitest::Heat::Map
- Inherits:
-
Object
- Object
- Minitest::Heat::Map
- Defined in:
- lib/minitest/heat/map.rb
Overview
Structured approach to collecting the locations of issues for generating a heat map
Constant Summary collapse
- MAXIMUM_FILES_TO_SHOW =
5
Instance Attribute Summary collapse
-
#hits ⇒ Object
readonly
Returns the value of attribute hits.
Instance Method Summary collapse
-
#add(pathname, line_number, type, backtrace: []) ⇒ void
Records a hit to the list of files and issue types.
-
#file_hits ⇒ Array
Returns a subset of affected files to keep the list from being overwhelming.
-
#initialize ⇒ Map
constructor
A new instance of Map.
Constructor Details
#initialize ⇒ Map
Returns a new instance of Map.
11 12 13 |
# File 'lib/minitest/heat/map.rb', line 11 def initialize @hits = {} end |
Instance Attribute Details
#hits ⇒ Object (readonly)
Returns the value of attribute hits.
9 10 11 |
# File 'lib/minitest/heat/map.rb', line 9 def hits @hits end |
Instance Method Details
#add(pathname, line_number, type, backtrace: []) ⇒ void
This method returns an undefined value.
Records a hit to the list of files and issue types
21 22 23 24 |
# File 'lib/minitest/heat/map.rb', line 21 def add(pathname, line_number, type, backtrace: []) @hits[pathname.to_s] ||= Hit.new(pathname) @hits[pathname.to_s].log(type.to_sym, line_number, backtrace: backtrace) end |
#file_hits ⇒ Array
Returns a subset of affected files to keep the list from being overwhelming
29 30 31 |
# File 'lib/minitest/heat/map.rb', line 29 def file_hits hot_files.take(MAXIMUM_FILES_TO_SHOW) end |