Class: DailyAffirmation::Validators::EqualityValidator
- Inherits:
-
DailyAffirmation::Validator
- Object
- DailyAffirmation::Validator
- DailyAffirmation::Validators::EqualityValidator
- Defined in:
- lib/daily_affirmation/validators/equality_validator.rb
Overview
This affirmation ensures an attribute is equal to the :value option given.
Instance Method Summary collapse
Methods inherited from DailyAffirmation::Validator
Constructor Details
This class inherits a constructor from DailyAffirmation::Validator
Instance Method Details
#error_message ⇒ Object
14 15 16 17 18 |
# File 'lib/daily_affirmation/validators/equality_validator.rb', line 14 def @error_message ||= ( :equality, :default => "#{attribute} is not '#{opts[:value]}'" ) end |
#valid? ⇒ Boolean
10 11 12 |
# File 'lib/daily_affirmation/validators/equality_validator.rb', line 10 def valid? @valid ||= (opts[:value] == value) end |