Class: Mixture::Validate::Match
- Defined in:
- lib/mixture/validate/match.rb
Overview
Checks that a value matches.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Mixture::Validate::Base
Instance Method Details
#match? ⇒ Boolean
12 13 14 |
# File 'lib/mixture/validate/match.rb', line 12 def match? @value =~ @options end |
#validate(record, attribute, value) ⇒ Object
7 8 9 10 |
# File 'lib/mixture/validate/match.rb', line 7 def validate(record, attribute, value) super error("Value does not match") unless match? end |