Class: Sinatra::ParamValidator::Rule::AllOrNoneOf
- Inherits:
-
Object
- Object
- Sinatra::ParamValidator::Rule::AllOrNoneOf
- Includes:
- Common
- Defined in:
- lib/sinatra/param_validator/rule/all_or_none_of.rb
Overview
Rule to enforce all given params, or none of them
Instance Attribute Summary
Attributes included from Common
Instance Method Summary collapse
Methods included from Common
Instance Method Details
#validate ⇒ Object
12 13 14 15 16 |
# File 'lib/sinatra/param_validator/rule/all_or_none_of.rb', line 12 def validate return if count.zero? || count == @fields.count @errors.push "All or none of [#{@fields.join ', '}] must be provided" end |