class Hermod::Validators::Base
def message(value, attributes)
Private: override in subclasses to provide a more useful error message
def message(value, attributes) "is invalid" end
def test(value, attributes)
validator
Private: override in subclasses to implement the logic for that
def test(value, attributes) raise NotImplementedError end
def valid?(value, attributes)
Raises a Hermod::InvalidInputError if the test fails
raising if it fails
Public: Runs the test for the validator returning true if it passes and
def valid?(value, attributes) !!test(value, attributes) || raise(InvalidInputError, message(value, attributes)) end