Class: DailyAffirmation::Validators::InclusionValidator
- Inherits:
-
DailyAffirmation::Validator
- Object
- DailyAffirmation::Validator
- DailyAffirmation::Validators::InclusionValidator
- Defined in:
- lib/daily_affirmation/validators/inclusion_validator.rb
Overview
This affirmation ensures an attribute is in the provided :list option.
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
13 14 15 16 17 18 |
# File 'lib/daily_affirmation/validators/inclusion_validator.rb', line 13 def @error_message ||= ( :inclusion, :default => "#{attribute} is not included in #{opts[:list]}" ) end |
#valid? ⇒ Boolean
9 10 11 |
# File 'lib/daily_affirmation/validators/inclusion_validator.rb', line 9 def valid? @valid ||= opts[:list].include?(value) end |