Class: Sinatra::ParamValidator::Rule::AnyOf

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/sinatra/param_validator/rule/any_of.rb

Overview

Rule to enforce at least one of the given params exists

Instance Attribute Summary

Attributes included from Common

#errors

Instance Method Summary collapse

Methods included from Common

#count, #initialize, #passes?

Instance Method Details

#validateObject



12
13
14
# File 'lib/sinatra/param_validator/rule/any_of.rb', line 12

def validate
  @errors.push "One of [#{@fields.join ', '}] must be provided" if count < 1
end