demarches-normaliennes/app/models/logic/or.rb
2022-06-17 14:53:27 +02:00

11 lines
245 B
Ruby

class Logic::Or < Logic::NAryOperator
attr_reader :operands
def operator_name = 'Ou'
def compute(champs = [])
@operands.map { |operand| operand.compute(champs) }.any?
end
def to_s = "(#{@operands.map(&:to_s).join(' || ')})"
end