demarches-normaliennes/app/models/logic/in_region_operator.rb
2024-02-13 11:57:31 +01:00

18 lines
360 B
Ruby

class Logic::InRegionOperator < Logic::BinaryOperator
def operation
:est_dans_la_region
end
def compute(champs)
l = @left.compute(champs)
r = @right.compute(champs)
return false if l.nil?
l.fetch(:code_region) == r
end
def errors(type_de_champs = [])
@left.errors(type_de_champs) + @right.errors(type_de_champs)
end
end