Class: Minitest::Subjective::FileResult::BranchStatistics::ConditionalHits

Inherits:
Struct
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#branchesObject

Returns the value of attribute branches

Returns:

  • (Object)

    the current value of branches



7
8
9
# File 'lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb', line 7

def branches
  @branches
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



7
8
9
# File 'lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb', line 7

def id
  @id
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



7
8
9
# File 'lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb', line 7

def label
  @label
end

#rangeObject

Returns the value of attribute range

Returns:

  • (Object)

    the current value of range



7
8
9
# File 'lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb', line 7

def range
  @range
end

Class Method Details

.from_pair(key, branches) ⇒ Object



12
13
14
15
# File 'lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb', line 12

def self.from_pair(key, branches)
  label, id, *range = key
  new(label:, id:, range: Range.from_array(range), branches: branches.collect { BranchHits.from_pair(*_1) })
end

Instance Method Details

#+(other) ⇒ Object



17
18
19
20
21
# File 'lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb', line 17

def +(other)
  return self unless matches?(other)

  self.class.new(label, id, range, branches.zip(other.branches).collect { |current, new| current + new })
end

#-(other) ⇒ Object



23
24
25
26
27
# File 'lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb', line 23

def -(other)
  return self unless matches?(other)

  self.class.new(label, id, range, branches.zip(other.branches).collect { |current, new| current - new })
end

#covered?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb', line 29

def covered?
  branches.all?(&:covered?)
end