1
0
Fork 0

Pair validation should be cumulative

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-23 12:52:25 +10:00
Ursprung 082be35199
Commit 07d0cbb0b4

Datei anzeigen

@ -84,9 +84,7 @@ class CustomWizard::Mapper
end end
def validate_pairs(pairs) def validate_pairs(pairs)
failed = false pairs.all? do |pair|
pairs.each do |pair|
key = map_field(pair['key'], pair['key_type']) key = map_field(pair['key'], pair['key_type'])
connector = pair['connector'] connector = pair['connector']
operator = map_operator(connector) operator = map_operator(connector)
@ -95,15 +93,13 @@ class CustomWizard::Mapper
map_field(pair['value'], pair['value_type']), map_field(pair['value'], pair['value_type']),
connector connector
) )
begin begin
failed = !cast_result(key.public_send(operator, value), connector) cast_result(key.public_send(operator, value), connector)
rescue NoMethodError rescue NoMethodError
# #
end end
end end
!failed
end end
def cast_value(key, value, connector) def cast_value(key, value, connector)