Class: DailyAffirmation::Validators::CustomValidator
- Inherits:
-
DailyAffirmation::Validator
- Object
- DailyAffirmation::Validator
- DailyAffirmation::Validators::CustomValidator
- Defined in:
- lib/daily_affirmation/validators/custom_validator.rb
Overview
This affirmation accepts a :proc option and evaluates it’s results.
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/custom_validator.rb', line 14 def @error_message ||= ( :custom, :default => "#{attribute} is invalid" ) end |
#valid? ⇒ Boolean
10 11 12 |
# File 'lib/daily_affirmation/validators/custom_validator.rb', line 10 def valid? @valid ||= opts[:proc].call(object) end |