Class: Minitest::Subjective::FileResult::BranchStatistics::BranchHits
- Inherits:
-
Struct
- Object
- Struct
- Minitest::Subjective::FileResult::BranchStatistics::BranchHits
- Extended by:
- Forwardable
- Defined in:
- lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb
Instance Attribute Summary collapse
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#id ⇒ Object
Returns the value of attribute id.
-
#label ⇒ Object
Returns the value of attribute label.
-
#range ⇒ Object
Returns the value of attribute range.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#hits ⇒ Object
Returns the value of attribute hits
7 8 9 |
# File 'lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb', line 7 def hits @hits end |
#id ⇒ Object
Returns the value of attribute id
7 8 9 |
# File 'lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb', line 7 def id @id end |
#label ⇒ Object
Returns the value of attribute label
7 8 9 |
# File 'lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb', line 7 def label @label end |
#range ⇒ Object
Returns the value of attribute range
7 8 9 |
# File 'lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb', line 7 def range @range end |
Class Method Details
.from_pair(key, hits) ⇒ Object
12 13 14 15 |
# File 'lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb', line 12 def self.from_pair(key, hits) label, id, *range = key new(label:, id:, range: Range.from_array(range), hits:) end |
Instance Method Details
#+(other) ⇒ Object
17 18 19 20 21 |
# File 'lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb', line 17 def +(other) return self unless matches?(other) self.class.new(label, id, range, hits + other.hits) end |
#-(other) ⇒ Object
23 24 25 26 27 |
# File 'lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb', line 23 def -(other) return self unless matches?(other) self.class.new(label, id, range, hits - other.hits) end |
#covered? ⇒ Boolean
29 30 31 |
# File 'lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb', line 29 def covered? hits.positive? end |