1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
|
# File 'lib/intermine/query.rb', line 1059
def validate_value(val)
nums = ["Float", "Double", "float", "double"]
ints = ["Integer", "int"]
bools = ["Boolean", "boolean"]
dataType = @path.elements.last.dataType.split(".").last
if nums.include?(dataType)
if !val.is_a?(Numeric)
raise ArgumentError, "value #{val} is not numeric for #{@path}"
end
end
if ints.include?(dataType)
val = val.to_i
if !val.is_a?(Integer)
raise ArgumentError, "value #{val} is not an integer for #{@path}"
end
end
if bools.include?(dataType)
if !val.is_a?(TrueClass) && !val.is_a?(FalseClass)
raise ArgumentError, "value #{val} is not a boolean value for #{@path}"
end
end
end
|