Class: Hermod::Validators::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hermod/validators/base.rb

Instance Method Summary collapse

Instance Method Details

#valid?(value, attributes) ⇒ Boolean

Public: Runs the test for the validator returning true if it passes and raising if it fails

Raises a Hermod::InvalidInputError if the test fails Returns true if it succeeds

Returns:

  • (Boolean)


11
12
13
# File 'lib/hermod/validators/base.rb', line 11

def valid?(value, attributes)
  !!test(value, attributes) || raise(InvalidInputError, message(value, attributes))
end