class Hermod::Validators::WholeUnits

Checks a decimal value has no decimal componant, i.e. it's just a decimal representation of an integer

Private Instance Methods

message(value, attributes) click to toggle source
# File lib/hermod/validators/whole_units.rb, line 15
def message(value, attributes)
  "must be in whole units"
end
test(value, attributes) click to toggle source
# File lib/hermod/validators/whole_units.rb, line 11
def test(value, attributes)
  value.blank? || value == value.to_i
end