Class: Validation::Rule::MinShouldMatch
- Inherits:
-
StretchyRule
- Object
- StretchyRule
- Validation::Rule::MinShouldMatch
- Defined in:
- lib/validation/rule/min_should_match.rb
Constant Summary collapse
- FORMAT_REGEX =
/^-?\d+([<>]-?\d+)?%?$/
Instance Method Summary collapse
Methods inherited from StretchyRule
#empty_ok?, #initialize, #invalid_empty?, #is_empty?, #params, #required?
Constructor Details
This class inherits a constructor from Validation::Rule::StretchyRule
Instance Method Details
#error_key ⇒ Object
7 8 9 |
# File 'lib/validation/rule/min_should_match.rb', line 7 def error_key :field end |
#valid_value?(value) ⇒ Boolean
11 12 13 14 |
# File 'lib/validation/rule/min_should_match.rb', line 11 def valid_value?(value) return true if empty_ok?(value) value.to_s =~ FORMAT_REGEX end |