jeudi 23 octobre 2014

Validating ruby float/integer between 0 and 1


Vote count:

0




I'm trying to write a validation function that checks a variable to see if it is between 0 and 1



unless xff.between?(0,1)
raise Puppet::ParseError, ("error message here")
end


If xff is 0.5 then it raises the error. How can I fix this so that it will accept float/integer values between (and including) 0 and 1?



asked 27 secs ago







Validating ruby float/integer between 0 and 1

Aucun commentaire:

Enregistrer un commentaire