class AFCSalesforce::Tools::Validation::Rule::Numeric
rule for numeric values
Public Instance Methods
error(value)
click to toggle source
# File lib/afc_salesforce/tools/validation/rule/numeric.rb, line 12 def error(value) results = {} results[:expected] = true results[:got] = valid_value?(value) results end
error_key()
click to toggle source
The error key for this rule
# File lib/afc_salesforce/tools/validation/rule/numeric.rb, line 20 def error_key :numeric end
params()
click to toggle source
this rule has no params
# File lib/afc_salesforce/tools/validation/rule/numeric.rb, line 25 def params {} end
valid_value?(value)
click to toggle source
Determines if value is numeric. It can only contain whole numbers
# File lib/afc_salesforce/tools/validation/rule/numeric.rb, line 8 def valid_value?(value) !!/^[0-9]+$/.match(value.to_s) end