Class: Respect::InValidator
- Inherits:
-
Validator
- Object
- Validator
- Respect::InValidator
- Defined in:
- lib/respect/in_validator.rb
Instance Method Summary (collapse)
-
- (InValidator) initialize(set)
constructor
A new instance of InValidator.
- - (Object) validate(value)
Methods inherited from Validator
Constructor Details
- (InValidator) initialize(set)
A new instance of InValidator
3 4 5 |
# File 'lib/respect/in_validator.rb', line 3 def initialize(set) @set = set end |
Instance Method Details
- (Object) validate(value)
7 8 9 10 11 |
# File 'lib/respect/in_validator.rb', line 7 def validate(value) unless @set.include?(value) raise ValidationError, "#{value.inspect} is not included in #@set" end end |