Class: Respect::GreaterThanOrEqualToValidator
- Inherits:
-
Validator
- Object
- Validator
- Respect::GreaterThanOrEqualToValidator
- Defined in:
- lib/respect/greater_than_or_equal_to_validator.rb
Instance Method Summary (collapse)
-
- (GreaterThanOrEqualToValidator) initialize(min)
constructor
A new instance of GreaterThanOrEqualToValidator.
- - (Object) validate(value)
Methods inherited from Validator
Constructor Details
- (GreaterThanOrEqualToValidator) initialize(min)
A new instance of GreaterThanOrEqualToValidator
3 4 5 |
# File 'lib/respect/greater_than_or_equal_to_validator.rb', line 3 def initialize(min) @min = min end |
Instance Method Details
- (Object) validate(value)
7 8 9 10 11 |
# File 'lib/respect/greater_than_or_equal_to_validator.rb', line 7 def validate(value) unless value >= @min raise ValidationError, "#{value} is not greater than or equal to #@min" end end |