Module: BinaryDecision

Includes:
Decision
Defined in:
lib/logic_operations.rb

Instance Method Summary collapse

Methods included from Decision

#mcdc_pairs, #test_cases, #truth_table

Instance Method Details

#condition_identifiersObject



39
40
41
# File 'lib/logic_operations.rb', line 39

def condition_identifiers
  elements.flat_map(&:condition_identifiers)
end

#evaluate(conditions) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/logic_operations.rb', line 43

def evaluate(conditions)
  left_value = left.evaluate(conditions)
  return left_value unless tail.elements.any?

  tail.elements.reduce(left_value) do |value, tail|
    tail.operator.apply(value, tail.operand.evaluate(conditions))
  end
end