class Hermod::Validators::NonNegative

Checks a number is not negative

Private Instance Methods

message(value, attributes) click to toggle source
# File lib/hermod/validators/non_negative.rb, line 14
def message(value, attributes)
  "cannot be negative"
end
test(value, attributes) click to toggle source
# File lib/hermod/validators/non_negative.rb, line 10
def test(value, attributes)
  value.blank? || value >= 0
end