I've run into a problem with the Cyclomatic complexity being too high for this ruby method:
def find_value(a, b, lookup_value)
return find_x1(a, b) if lookup_value == 'x1'
return find_x2(a, b) if lookup_value == 'x2'
return find_x3(a, b) if lookup_value == 'x3'
return find_x4(a, b) if lookup_value == 'x4'
return find_x5(a, b) if lookup_value == 'x5'
return find_x6(lookup_value) if lookup_value.include? 'test'
end
Is there any way of writing this without having to use eval
?