Class: DailyAffirmation::Validators::NumericalityValidator
- Inherits:
-
DailyAffirmation::Validator
- Object
- DailyAffirmation::Validator
- DailyAffirmation::Validators::NumericalityValidator
- Defined in:
- lib/daily_affirmation/validators/numericality_validator.rb
Overview
This affirmation ensures an attribute is a Number and if the :greater_than or :less_then option is given, that the attribute is greater than or less than the value provided.
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
18 19 20 21 22 |
# File 'lib/daily_affirmation/validators/numericality_validator.rb', line 18 def @error_message ||= ( :numericality, :default => ) end |
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/daily_affirmation/validators/numericality_validator.rb', line 14 def valid? @valid ||= value ? numeric? && greater_than? && less_than? : true end |