Class: AocCli::Validators::CollectionTypeValidator
- Inherits:
-
Kangaru::Validator
- Object
- Kangaru::Validator
- AocCli::Validators::CollectionTypeValidator
- Defined in:
- lib/aoc_cli/validators/collection_type_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/aoc_cli/validators/collection_type_validator.rb', line 4 def validate validate_preconditions! return add_error!("can't be blank") if value.nil? return add_error!("is not an array") unless value.is_a?(Array) case validation_rule when :all then validate_all_elements! when :any then validate_any_elements! when :none then validate_none_elements! else raise end end |