Class: Respect::EqualToValidator
- Inherits:
-
Validator
- Object
- Validator
- Respect::EqualToValidator
- Defined in:
- lib/respect/equal_to_validator.rb
Instance Method Summary (collapse)
-
- (EqualToValidator) initialize(expected)
constructor
A new instance of EqualToValidator.
- - (Object) validate(value)
Methods inherited from Validator
Constructor Details
- (EqualToValidator) initialize(expected)
A new instance of EqualToValidator
3 4 5 |
# File 'lib/respect/equal_to_validator.rb', line 3 def initialize(expected) @expected = expected end |
Instance Method Details
- (Object) validate(value)
7 8 9 10 11 12 |
# File 'lib/respect/equal_to_validator.rb', line 7 def validate(value) unless value == @expected raise ValidationError, "wrong value: `#{value}':#{value.class} instead of `#@expected':#{@expected.class}" end end |