Class: Hermod::Validators::Base
- Inherits:
-
Object
- Object
- Hermod::Validators::Base
- Defined in:
- lib/hermod/validators/base.rb
Direct Known Subclasses
AllowedValues, Attributes, NonNegative, NonZero, Range, RegularExpression, TypeChecker, ValuePresence, WholeUnits
Instance Method Summary collapse
-
#valid?(value, attributes) ⇒ Boolean
Public: Runs the test for the validator returning true if it passes and raising if it fails.
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
11 12 13 |
# File 'lib/hermod/validators/base.rb', line 11 def valid?(value, attributes) !!test(value, attributes) || raise(InvalidInputError, (value, attributes)) end |