Class: Minitest::Subjective::FileResult::LineStatistics::LineHits
- Inherits:
-
Struct
- Object
- Struct
- Minitest::Subjective::FileResult::LineStatistics::LineHits
- Defined in:
- lib/minitest/subjective/file_result/line_statistics/line_hits.rb
Instance Attribute Summary collapse
-
#branches ⇒ Object
Returns the value of attribute branches.
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#line ⇒ Object
Returns the value of attribute line.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#branches ⇒ Object
Returns the value of attribute branches
7 8 9 |
# File 'lib/minitest/subjective/file_result/line_statistics/line_hits.rb', line 7 def branches @branches end |
#hits ⇒ Object
Returns the value of attribute hits
7 8 9 |
# File 'lib/minitest/subjective/file_result/line_statistics/line_hits.rb', line 7 def hits @hits end |
#line ⇒ Object
Returns the value of attribute line
7 8 9 |
# File 'lib/minitest/subjective/file_result/line_statistics/line_hits.rb', line 7 def line @line end |
Class Method Details
.from_pair(line, hits, branches: nil) ⇒ Object
8 9 10 |
# File 'lib/minitest/subjective/file_result/line_statistics/line_hits.rb', line 8 def self.from_pair(line, hits, branches: nil) new(line:, hits:, branches:) end |
Instance Method Details
#+(other) ⇒ Object
12 13 14 15 16 |
# File 'lib/minitest/subjective/file_result/line_statistics/line_hits.rb', line 12 def +(other) return self unless other && other.line == line self.class.new(line, hits + other.hits, branches && (branches + other.branches)) end |
#-(other) ⇒ Object
18 19 20 21 22 |
# File 'lib/minitest/subjective/file_result/line_statistics/line_hits.rb', line 18 def -(other) return self unless other && other.line == line self.class.new(line, hits - other.hits, branches && (branches - other.branches)) end |
#covered? ⇒ Boolean
24 25 26 |
# File 'lib/minitest/subjective/file_result/line_statistics/line_hits.rb', line 24 def covered? hits.positive? && (branches.nil? || branches.covered?) end |