demarches-normaliennes/app/models/logic/or.rb
simon lehericey 43f926a1de to_s
2022-09-28 10:06:31 +02:00

11 lines
289 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(type_de_champs = []) = "(#{@operands.map { |o| o.to_s(type_de_champs) }.join(' || ')})"
end