Class: Stattleship::Validators::LevelValidator
- Inherits:
-
BaseValidator
- Object
- BaseValidator
- Stattleship::Validators::LevelValidator
- Defined in:
- lib/stattleship/validators/level_validator.rb
Constant Summary collapse
- VALID_LEVELS =
%w(typical common often rare record_tying record).freeze
Instance Method Summary collapse
Methods inherited from BaseValidator
#initialize, #validates_date, #validates_league_prefix, #validates_positive_integer, #validates_positive_or_zero_integer, #validates_sport_prefix
Constructor Details
This class inherits a constructor from Stattleship::Validators::BaseValidator
Instance Method Details
#validate ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/stattleship/validators/level_validator.rb', line 6 def validate if VALID_LEVELS.include?(value) return else fail ArgumentError. new("expected #{key} to be either #{VALID_LEVELS.join(', ')}") end end |